Skip to content

Commit

Permalink
Changes for building fakeredis and Flor rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Mar 3, 2024
1 parent e0f843c commit e9324b9
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 17 deletions.
7 changes: 4 additions & 3 deletions data/projects.ini
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,11 @@ description_long: Discover and load entry points from installed packages
version: >=1.1.0
dpkg_build_dependencies: python3-poetry-core
build_system: poetry
maintainer: Bruce Merry <[email protected]>
homepage_url: https://github.com/jamesls/fakeredis
rpm_template_spec: fakeredis.spec
maintainer: Daniel Moran <[email protected]>
homepage_url: https://github.com/cunla/fakeredis-py
download_url: https://pypi.org/project/fakeredis
git_url: https://github.com/jamesls/fakeredis.git
git_url: https://github.com/cunla/fakeredis-py.git
description_short: A fake version of a redis-py
description_long: Fake implementation of redis API (redis-py) for testing
purposes
Expand Down
9 changes: 4 additions & 5 deletions data/rpm_templates/Flor.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ BuildRequires: python3-devel, python3-setuptools
%description
A Bloom filter implementation in Python

%package -n python3-%{{name}}
%package -n python3-flor
Summary: Python 3 module of Flor - An efficient Bloom filter implementation in Python

%description -n python3-%{{name}}
%description -n python3-flor
A Bloom filter implementation in Python

%prep
Expand All @@ -39,9 +39,8 @@ rm -rf %{{buildroot}}/usr/share/doc/%{{name}}/
%clean
rm -rf %{{buildroot}}

%files -n python3-%{{name}}


%files -n python3-flor
%doc README.md
%{{python3_sitelib}}/flor
%{{python3_sitelib}}/Flor*.egg-info

Expand Down
44 changes: 44 additions & 0 deletions data/rpm_templates/fakeredis.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
%define name fakeredis
%define version {version}
%define release 1

Name: %{{name}}
Version: %{{version}}
Release: %{{release}}
Summary: A fake version of a redis-py
License: BSD-3-Clause
URL: https://github.com/cunla/fakeredis-py
Source: %{{name}}-%{{version}}.tar.gz
BuildArch: noarch
BuildRequires: python3-devel, python3-poetry-core, python3-tox-current-env

%description
Fake implementation of redis API (redis-py) for testing purposes

%package -n python3-%{{name}}
Summary: A fake version of a redis-py

%description -n python3-%{{name}}
Fake implementation of redis API (redis-py) for testing purposes

%prep
%autosetup -p1 -n %{{name}}-%{{version}}

%generate_buildrequires
%pyproject_buildrequires -t

%build
%pyproject_wheel

%install
%pyproject_install

%files -n python3-%{{name}}
%license LICENSE
%doc README.md
%{{python3_sitelib}}/fakeredis
%{{python3_sitelib}}/fakeredis*.dist-info

%changelog
* {date_time} log2timeline development team <[email protected]> {version}-1
- Auto-generated
12 changes: 6 additions & 6 deletions l2tdevtools/build_helpers/dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _CreatePackagingFiles(self, source_directory, project_version):
# the dpkg directory.
if os.path.exists(debian_directory):
logging.info('Removing: {0:s}'.format(debian_directory))
shutil.rmtree(debian_directory)
shutil.rmtree(debian_directory, ignore_errors=True)

dpkg_directory = os.path.join(source_directory, 'dpkg')

Expand Down Expand Up @@ -580,7 +580,7 @@ def Build(self, source_helper_object):
temporary_directory = os.path.join(source_directory, 'tmp')
if os.path.exists(temporary_directory):
logging.info('Removing: {0:s}'.format(temporary_directory))
shutil.rmtree(temporary_directory)
shutil.rmtree(temporary_directory, ignore_errors=True)

if not self._BuildPrepare(
source_directory, source_helper_object.project_name, project_version,
Expand Down Expand Up @@ -698,7 +698,7 @@ def Build(self, source_helper_object):
temporary_directory = os.path.join(source_directory, 'tmp')
if os.path.exists(temporary_directory):
logging.info('Removing: {0:s}'.format(temporary_directory))
shutil.rmtree(temporary_directory)
shutil.rmtree(temporary_directory, ignore_errors=True)

if not self._BuildPrepare(
source_directory, source_helper_object.project_name, project_version,
Expand Down Expand Up @@ -832,7 +832,7 @@ def _DetermineBuildConfiguration(self, source_directory):
build_configuration.has_bin_directory = True

if os.path.exists(installroot_path):
shutil.rmtree(installroot_path)
shutil.rmtree(installroot_path, ignore_errors=True)

return build_configuration

Expand Down Expand Up @@ -929,7 +929,7 @@ def Build(self, source_helper_object):
temporary_directory = os.path.join(source_directory, 'tmp')
if os.path.exists(temporary_directory):
logging.info('Removing: {0:s}'.format(temporary_directory))
shutil.rmtree(temporary_directory)
shutil.rmtree(temporary_directory, ignore_errors=True)

if not self._BuildPrepare(
source_directory, project_name, project_version, self.version_suffix,
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def Build(self, source_helper_object):
temporary_directory = os.path.join(source_directory, 'tmp')
if os.path.exists(temporary_directory):
logging.info('Removing: {0:s}'.format(temporary_directory))
shutil.rmtree(temporary_directory)
shutil.rmtree(temporary_directory, ignore_errors=True)

if not self._BuildPrepare(
source_directory, project_name, project_version, self.version_suffix,
Expand Down
4 changes: 4 additions & 0 deletions l2tdevtools/build_helpers/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ class BuildHelperFactory(object):
'wheel': wheel.FlitWheelBuildHelper,
}

# Note that the rpm and srpm setup.py build helpers are used to build
# projects that use poetry.
_POETRY_BUILD_HELPER_CLASSES = {
'dpkg': dpkg.PybuildDPKGBuildHelper,
'dpkg-source': dpkg.PybuildSourceDPKGBuildHelper,
'rpm': rpm.SetupPyRPMBuildHelper,
'srpm': rpm.SetupPySRPMBuildHelper,
'wheel': wheel.PoetryWheelBuildHelper,
}

Expand Down
2 changes: 1 addition & 1 deletion l2tdevtools/build_helpers/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _RemoveOlderSourceDirectories(self, project_name, project_version):
for filename in filenames:
if os.path.isdir(filename) and not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
shutil.rmtree(filename)
shutil.rmtree(filename, ignore_errors=True)

def _RemoveOlderSourcePackages(self, project_name, project_version):
"""Removes previous versions of source packages.
Expand Down
4 changes: 2 additions & 2 deletions l2tdevtools/build_helpers/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _RemoveOlderBuildDirectory(self, project_name, project_version):
for filename in filenames:
if not filenames_to_ignore.match(filename):
logging.info('Removing: {0:s}'.format(filename))
shutil.rmtree(filename)
shutil.rmtree(filename, ignore_errors=True)

def _RemoveOlderRPMs(self, project_name, project_version):
"""Removes previous versions of .rpm files.
Expand Down Expand Up @@ -557,7 +557,7 @@ def Clean(self, source_helper_object):
for filename in ('build', 'dist'):
if os.path.exists(filename):
logging.info('Removing: {0:s}'.format(filename))
shutil.rmtree(filename, True)
shutil.rmtree(filename, ignore_errors=True)

# Remove previous versions of rpms.
project_name, project_version = self._GetFilenameSafeProjectInformation(
Expand Down

0 comments on commit e9324b9

Please sign in to comment.