diff --git a/data/projects.ini b/data/projects.ini index 5f8f988a..59b1fd6b 100644 --- a/data/projects.ini +++ b/data/projects.ini @@ -29,11 +29,10 @@ description_long: Fast ASN.1 parser and serializer with definitions PKCS#7, PKCS#8, PKCS#12, PKCS#5, X.509 and TSP [bencode] -dpkg_build_dependencies: python3-pbr -dpkg_dependencies: python3-pbr -rpm_build_dependencies: python3-pbr +version: >=4.1.0 +build_system: setuptools rpm_template_spec: bencode.spec -setup_name: bencode.py +setup_name: bencode_py wheel_name: bencode_py homepage_url: https://github.com/fuzeman/bencode.py download_url: https://pypi.org/project/bencode.py diff --git a/data/rpm_templates/bencode.spec b/data/rpm_templates/bencode.spec index 0be5ea71..d1f0b95c 100644 --- a/data/rpm_templates/bencode.spec +++ b/data/rpm_templates/bencode.spec @@ -1,50 +1,41 @@ -%define name bencode -%define version {version} -%define unmangled_name bencode.py -%define unmangled_version {version} -%define release 1 - -Summary: Simple bencode parser -Name: %{{name}} -Version: %{{version}} -Release: %{{release}} -Source0: %{{unmangled_name}}-%{{unmangled_version}}.tar.gz -License: BitTorrent Open Source License +Name: bencode +Version: {version} +Release: 1 Group: Development/Libraries -BuildRoot: %{{_tmppath}}/%{{unmangled_name}}-release-%{{version}}-%{{release}}-buildroot -Prefix: %{{_prefix}} -BuildArch: noarch -Vendor: Dean Gardiner +License: BitTorrent Open Source License +Summary: Simple bencode parser Url: https://github.com/fuzeman/bencode.py -BuildRequires: python3-setuptools >= 17.0 , python3-devel, python3-pbr +Vendor: Dean Gardiner +Source0: bencode_py-%{{version}}.tar.gz +BuildArch: noarch +BuildRequires: python3-devel, pyproject-rpm-macros, python3-pip, python3-setuptools, python3-wheel + +%{{?python_disable_dependency_generator}} %description Simple bencode parser, forked from the bencode package by Thomas Rampelberg. %package -n python3-%{{name}} -Summary: Simple bencode parser for Python 3 +Summary: Python 3 module of Simple bencode parser %description -n python3-%{{name}} Simple bencode parser, forked from the bencode package by Thomas Rampelberg. %prep -%autosetup -n %{{unmangled_name}}-%{{unmangled_version}} +%autosetup -p1 -n bencode_py-%{{version}} %build %pyproject_wheel %install %pyproject_install -rm -rf %{{buildroot}}/usr/share/doc/%{{name}}/ - -%clean -rm -rf %{{buildroot}} - %files -n python3-%{{name}} -%{{python3_sitelib}}/bencode/ -%{{python3_sitelib}}/bencodepy/ +%license LICENSE + +%{{python3_sitelib}}/bencode +%{{python3_sitelib}}/bencodepy %{{python3_sitelib}}/bencode_py*.dist-info %changelog diff --git a/l2tdevtools/spec_file.py b/l2tdevtools/spec_file.py index 0cdd2e04..e249797d 100644 --- a/l2tdevtools/spec_file.py +++ b/l2tdevtools/spec_file.py @@ -34,7 +34,6 @@ class RPMSpecFileGenerator: "%description -n %{{name}}-data", "{description:s}", "", - "", ] _SPEC_TEMPLATE_PYTHON3_BODY = [ @@ -47,7 +46,6 @@ class RPMSpecFileGenerator: "%install", "%pyproject_install", "", - "", ] _SPEC_TEMPLATE_TOOLS_PACKAGE_DEFINITION = [ @@ -58,7 +56,6 @@ class RPMSpecFileGenerator: "%description -n %{{name}}-tools", "{description:s}", "", - "", ] LOG_FILENAME = "build.log" @@ -107,7 +104,6 @@ def _GenerateSpecFile( "vendor": None, "version": None, } - has_data_package = False python_module_name = project_name @@ -124,7 +120,6 @@ def _GenerateSpecFile( os.path.isdir(tools_directory) and glob.glob(os.path.join(tools_directory, "*.py")) ) - if project_definition.srpm_name: package_name = project_definition.srpm_name elif project_definition.rpm_name: @@ -167,7 +162,11 @@ def _GenerateSpecFile( ) if not configuration["license"]: - configuration["license"] = pyproject_toml_project.get("license", None) + license_value = pyproject_toml_project.get("license") + if isinstance(license_value, dict): + license_value = license_value.get("text") + + configuration["license"] = license_value if not configuration["summary"]: configuration["summary"] = pyproject_toml_project.get( @@ -262,7 +261,6 @@ def _GenerateSpecFile( build_requires, configuration, ) - if project_name != package_name: python_package_name = f"python3-{package_name:s}" else: @@ -278,7 +276,6 @@ def _GenerateSpecFile( configuration, output_file_object, ) - if has_tools_package: self._WriteToolsPackageDefinition(output_file_object, configuration) @@ -299,7 +296,6 @@ def _GenerateSpecFile( license_line, doc_line, ) - if has_tools_package: self._WriteToolsPackageFiles(output_file_object) @@ -351,7 +347,6 @@ def _GetInstallDefinition(self, project_name): ), "rm -rf %{buildroot}/usr/share/doc/%{name}/", ] - if project_name == "astroid": lines.extend(["rm -rf %{buildroot}%{python3_sitelib}/astroid/tests"]) @@ -359,6 +354,7 @@ def _GetInstallDefinition(self, project_name): lines.extend(["rm -rf %{buildroot}%{python3_sitelib}/pylint/test"]) lines.append("") + return "\n".join(lines) def _GetLicenseFileDefinition(self, source_directory): @@ -441,11 +437,9 @@ def _WriteChangeLog(self, output_file_object, version): date_time_string = date_time.strftime("%a %b %e %Y") output_file_object.write( - ( - "%changelog\n" - f"* {date_time_string:s} {self._EMAIL_ADDRESS:s} {version:s}-1\n" - "- Auto-generated\n" - ) + "%changelog\n" + f"* {date_time_string:s} {self._EMAIL_ADDRESS:s} {version:s}-1\n" + "- Auto-generated\n" ) def _WriteDataPackageDefinition(self, output_file_object, configuration): @@ -459,7 +453,6 @@ def _WriteDataPackageDefinition(self, output_file_object, configuration): "description": configuration["description"], "summary": configuration["summary"], } - output_string = "\n".join(self._SPEC_TEMPLATE_DATA_PACKAGE_DEFINITION) output_string = output_string.format(**template_mappings) output_file_object.write(output_string) @@ -477,9 +470,7 @@ def _WriteDataPackageFiles(self, output_file_object): "%doc ACKNOWLEDGEMENTS AUTHORS README.md", "%{_datadir}/%{name}/*", "", - "", ] - output_string = "\n".join(template) output_file_object.write(output_string) @@ -536,7 +527,6 @@ def _WritePython3PackageDefinition( "requires": ", ".join(requires), "summary": configuration["summary"], } - template = ["%package -n {name:s}"] if requires: @@ -549,10 +539,8 @@ def _WritePython3PackageDefinition( "%description -n {name:s}", "{description:s}", "", - "", ] ) - output_string = "\n".join(template) output_string = output_string.format(**template_mappings) output_file_object.write(output_string) @@ -592,7 +580,6 @@ def _WritePython3PackageFiles( "name": name, "setup_name": setup_name, } - template = ["%files -n {name:s}", "{license:s}", "{doc:s}"] if project_definition.architecture_dependent: @@ -602,7 +589,6 @@ def _WritePython3PackageFiles( "%{{_libdir}}/python3*/site-packages/{setup_name:s}*.dist-info", ] ) - else: template.extend( [ @@ -648,7 +634,6 @@ def _WriteSpecFileFromTempate( "rpm_requires": ", ".join(rpm_requires), "version": project_version, } - template_file_path = os.path.join( self._data_path, "rpm_templates", project_definition.rpm_template_spec ) @@ -700,7 +685,6 @@ def _WriteSourcePackageDefinition( "vendor": configuration["vendor"], "version": configuration["version"], } - template = [ "Name: {name:s}", "Version: {version:s}", @@ -711,7 +695,6 @@ def _WriteSourcePackageDefinition( "Url: {url:s}", "Vendor: {vendor:s}", ] - template.append("Source0: {source:s}") if not project_definition.architecture_dependent: @@ -728,10 +711,8 @@ def _WriteSourcePackageDefinition( "%description", "{description:s}", "", - "", ] ) - output_string = "\n".join(template) output_string = output_string.format(**template_mappings) output_file_object.write(output_string) @@ -748,7 +729,6 @@ def _WriteToolsPackageDefinition(self, output_file_object, configuration): "project_name": configuration["name"], "summary": configuration["summary"], } - output_string = "\n".join(self._SPEC_TEMPLATE_TOOLS_PACKAGE_DEFINITION) output_string = output_string.format(**template_mappings) output_file_object.write(output_string) @@ -790,7 +770,6 @@ def Generate( "python3-setuptools", "python3-wheel", ] - if project_definition.architecture_dependent: rpm_build_dependencies.append("gcc") diff --git a/tests/download_helpers/github.py b/tests/download_helpers/github.py index 177ec484..82245488 100644 --- a/tests/download_helpers/github.py +++ b/tests/download_helpers/github.py @@ -104,7 +104,7 @@ class LibyalGitHubReleasesDownloadHelperTest(test_lib.BaseTestCase): _PROJECT_ORGANIZATION = "libyal" _PROJECT_NAME = "libevt" _PROJECT_STATUS = "alpha" - _PROJECT_VERSION = "20260523" + _PROJECT_VERSION = "20260705" @classmethod def setUpClass(cls): diff --git a/tests/download_helpers/pypi.py b/tests/download_helpers/pypi.py index d9a8d0d8..297948e6 100644 --- a/tests/download_helpers/pypi.py +++ b/tests/download_helpers/pypi.py @@ -18,8 +18,8 @@ class PyPIDownloadHelperTest(test_lib.BaseTestCase): _GIT_URL = "https://github.com/log2timeline/dfvfs.git" _PROJECT_NAME = "dfvfs" - _PROJECT_VERSION = "20260411" - _PYPI_VERSION = "20260411" + _PROJECT_VERSION = "20260712" + _PYPI_VERSION = "20260712" @classmethod def setUpClass(cls):