{"id":16106147,"url":"https://github.com/hroncok/pyprojectize","last_synced_at":"2025-04-13T07:55:55.024Z","repository":{"id":257816185,"uuid":"864183291","full_name":"hroncok/pyprojectize","owner":"hroncok","description":"Convert a spec file from %py3_build etc. macros to %pyproject_*","archived":false,"fork":false,"pushed_at":"2024-12-03T11:33:56.000Z","size":4279,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T07:55:49.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hroncok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-27T16:43:21.000Z","updated_at":"2025-01-12T18:24:53.000Z","dependencies_parsed_at":"2024-10-12T00:17:18.499Z","dependency_job_id":null,"html_url":"https://github.com/hroncok/pyprojectize","commit_stats":null,"previous_names":["hroncok/pyprojectize"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hroncok%2Fpyprojectize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hroncok%2Fpyprojectize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hroncok%2Fpyprojectize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hroncok%2Fpyprojectize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hroncok","download_url":"https://codeload.github.com/hroncok/pyprojectize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248681490,"owners_count":21144700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T19:12:07.204Z","updated_at":"2025-04-13T07:55:55.000Z","avatar_url":"https://github.com/hroncok.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyprojectize\n============\n\n\u003c!-- [[[cog\nimport pyprojectize, os, pathlib, urllib3\nprint(pyprojectize.__doc__)\nprint(\"```\")\nprint(\"$ python pyprojectize.py --help\")\npyprojectize.__doc__ = \"\"\npyprojectize.argparser().print_help()\nprint()\ncommit = \"16a7deeb\"\nspec = pathlib.Path(\"ampy.spec\")\nresponse = urllib3.PoolManager().request(\"GET\", f\"https://src.fedoraproject.org/rpms/ampy/raw/{commit}/f/ampy.spec\")\nspec.write_bytes(response.data)\nprint(f\"$ python pyprojectize.py ampy.spec  # {commit}\")\npyprojectize.main([str(spec)])\nspec.unlink()\nprint(\"```\")\n]]] --\u003e\n\nThis helps you convert a Fedora RPM spec file from `%py3_build` etc. to `%pyproject` macros.\nThis program only operates on the spec file itself, and hence has limited knowledge.\nThe resulting spec file is not guaranteed to be buildable and manual verification\nand completion of the transition is strongly advised.\n\n```\n$ python pyprojectize.py --help\nusage: pyprojectize [-h] [-l] [-i MODIFIER] [-x MODIFIER [MODIFIER ...] | -o MODIFIER] [-s SOURCEDIR]\n                    [SPECFILE]\n\npositional arguments:\n  SPECFILE              path to the spec file to convert\n\noptions:\n  -h, --help            show this help message and exit\n  -l, --list-modifiers  list all available modifiers and exit\n  -i, --info MODIFIER   display documentation for given modifier\n  -x, --exclude MODIFIER [MODIFIER ...]\n                        exclude given modifier\n  -o, --only MODIFIER   run only one given modifier\n  -s, --sourcedir SOURCEDIR\n                        path to the source directory, relevant for %include etc. (default: spec's parent)\n\nIf you wish to process multiple specfiles at a time, run this tool via parallel, etc. If you wish to\ninspect/commit result of each modififer separatelly, you can loop over pyprojectize -l calling pyprojectize -o\n$modifer each time.\n\n$ python pyprojectize.py ampy.spec  # 16a7deeb\n✅ add_pyproject_buildrequires: %generate_buildrequires with %pyproject_buildrequires added\n✅ remove_setuptools_br: removed BuildRequires for setuptools\n✅ py3_build_to_pyproject_wheel: replaced %py3_build with %pyproject_wheel in %build\n✅ py3_install_to_pyproject_install: replaced %py3_install with %pyproject_install in %install\n✅ egginfo_to_distinfo: replaced .egg-info with .dist-info in %files\n✅ add_pyproject_files: %{python3_sitelib}/%{python3_sitearch} lines replaced with %{pyproject_files}\n✅ add_pyproject_check_import: existing %check prepended with %pyproject_check_import\n👌 update_extras_subpkg: %{?python_extras_subpkg:%python_extras_subpkg ...} not found\n✅ remove_python_provide: %python_provide removed or replaced with %py_provides\n✅ remove_python_enable_dependency_generator: %python_enable_dependency_generator removed\n✅ remove_pyp2rpm_comment: # Created by pyp2rpm-X.Y.Z comment removed\n👌 remove_remove_bundled_egginfo: no removal of bundled .egg-info\n```\n\u003c!-- [[[end]]] --\u003e\n\n## Demo\n\nhttps://github.com/hroncok/pyprojectize/compare/originals..specfiles\n\n## Installation\n\nThis is a pip-installable package.\n\n    pip install pyprojectize\n\nOr use `uv`, `pipx` etc.\n\n## Available modifiers\n\n\u003c!-- [[[cog\nfor name, func in pyprojectize._modifiers.items():\n    print()\n    print(f\"### {name}\")\n    print()\n    print(pyprojectize.docstring(func))\n    print()\n]]] --\u003e\n\n### add_pyproject_buildrequires\n\nIf there is no `%generate_buildrequires` section, add it after `%prep`.\n\nInsert `%pyproject_buildrequires` to the end of `%generate_buildrequires`.\n\n\n### remove_setuptools_br\n\nRemove BuildRequires for setuptools, they should be generated.\n\n\n### py3_build_to_pyproject_wheel\n\nIn the `%build` section, replace `%py3_build` with `%pyproject_wheel`.\nArguments (if any) are passed to `-C--global-option`.\nEnvironment variables (if any) are exported on the previous line.\n\n\n### py3_install_to_pyproject_install\n\nIn the `%install` section, replace `%py3_install` with `%pyproject_install`.\nAny arguments or environment variables are discarded. Installing a wheel does not need those.\n\n\n### egginfo_to_distinfo\n\nIn all the `%files` sections, replace `.egg-info` with `.dist-info`.\nThe `.dist-info` filename is updated if possible (e.g. to use canonical name and version).\nWorks reasonably well even with macronized filenames.\n\n\n### add_pyproject_files\n\nIf there is only one `%files` section with `%{python3_sitelib}` or `%{python3_sitearch}`,\nreplace the manually listed files with `%pyproject_save_files` and `-f %{pyproject_files}`.\n\nIn case the `%license` files match patterns recognized by setuptools' defaults,\nuses `%pyproject_save_files` with `-l` and removes them.\n\n\n### add_pyproject_check_import\n\nIf `%pyproject_save_files` is used in `%install` and `%pyproject_check_import`\nis not used in `%check`, add `%pyproject_check_import` to the beginning of `%check`\n(create the section if needed).\n\n\n### update_extras_subpkg\n\nReplace `%python_extras_subpkg -i ...` with `%pyproject_extras_subpkg`,\npreserve other arguments.\n\n\n### remove_python_provide\n\nRemove `%python_provide` or replace it with `%py_provides` if the package name isn't the same.\n\nIf `%py_provides` is added, also remove the `Provides:` for the same name.\n\nThis does not detect packages without files yet.\nPackages without files need  `%py_provides` even when the package name is the same.\n\n\n### remove_python_enable_dependency_generator\n\nRemove `%python_enable_dependency_generator`, as the generator is enabled by default.\n\n\n### remove_pyp2rpm_comment\n\nRemove the `# Created by pyp2rpm-X.Y.Z` comment.\nThe spec file is changed enough for this to no longer matter.\n\n\n### remove_remove_bundled_egginfo\n\nRemove the `# Remove bundled egg-info` comment and the followup `rm ...egg-info`.\nThere is no such thing as \"bundled egg-info\".\n\n\u003c!-- [[[end]]] --\u003e\n\n## License\n\n[MIT-0](https://spdx.org/licenses/MIT-0.html), see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhroncok%2Fpyprojectize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhroncok%2Fpyprojectize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhroncok%2Fpyprojectize/lists"}