217 Commits
Author SHA1 Message Date
Karolina Surma 2d98f31955 Run tests with Python 3.15 2025-12-22 11:09:22 +01:00
Karolina Surma 8794d0963f Add a newline at the end of the specfile (fixes #65) 2025-12-22 11:09:03 +01:00
Karolina Surma 26bddd8ce3 Bump version 0.12.2 -> 0.13.0 2025-07-31 10:17:42 +02:00
Karolina SurmaandKarolina Surma f1cc06e490 Get rid of "pypi" prefix from the config values
Now there are two possible sources to read metadata from,
one of them entirely local without any involvement of PyPI.
Change the values accordingly.
2025-07-23 10:40:36 +02:00
Karolina SurmaandKarolina Surma 40b55ee132 Generate specfiles for packages built locally
With `pyp2spec <pkgname> --path /pth/to/artifacts` a specfile will be
now generated from data available in sdist and wheel.
The `--path` option takes as a value a directory where the built artifacts
are stored.
2025-07-23 10:40:36 +02:00
Karolina Surma 2afd5176ad Port to PEP 639 2025-07-02 13:58:55 +02:00
Karolina Surma 63af6bcbc5 Delete a leftover unused cassette 2025-07-02 13:58:39 +02:00
demusandKarolina Surma e5c63a388c Ensure project_urls is not None when it's "project_urls": null in the json 2025-04-17 09:32:15 +02:00
demusandKarolina Surma ea34a694b6 Try project_url and package_url from the metadata before crashing 2025-04-08 09:52:41 +02:00
Karolina Surma 0a226320df Bump version 0.11.1 -> 0.12.0 2025-03-03 11:11:39 +01:00
Karolina Surma e89b4168c5 Update the list of trove license classifiers 2025-02-27 10:38:37 +01:00
Karolina SurmaandKarolina Surma 4a36396d23 Read extras first from provides_extra, then requires_dist (closes #57) 2025-02-25 14:56:22 +01:00
Karolina Surma d552ce37c9 Improve passing of CLI args in pyp2conf (closes #56) 2025-02-25 10:54:28 +01:00
Karolina SurmaandKarolina Surma c762cc39a9 Run CI on pushes to main, otherwise on PRs 2025-02-25 09:22:23 +01:00
Karolina SurmaandKarolina Surma fa92c916dc Pass the dictionary of CLI options rather than one by one 2025-02-25 09:22:23 +01:00
Karolina SurmaandKarolina Surma ba55c5a90a Create spec files with pyproject declarative buildsystem
This is an experimental build system added to rpm 4.20
and provisionally added to pyproject macros.
See:
https://rpm-software-management.github.io/rpm/manual/buildsystem.html
and
https://src.fedoraproject.org/rpms/pyproject-rpm-macros
(section: Provisional: Declarative Buildsystem (RPM 4.20+))
2025-02-25 09:22:23 +01:00
Karolina SurmaandKarolina Surma 3c6a738744 Account with package names ending with digits 2025-02-24 14:39:55 +01:00
Karolina SurmaandKarolina Surma 2cca4d3844 Support compat packages (Closes #15)
When specified on command line, a compat package for a given version
will be created.
pyp2spec will create a specfile for the latest version matching the
compat one, e.g. for `pytest --compat 7` it will create specfile for
version 7.4.4; for `pytest --compat 7.2` - 7.2.2.
It is possible to specify both compat and specific version, e.g.:
`pytest --compat 7 --version 7.3.0`
2025-02-24 14:39:55 +01:00
Karolina Surma fc17319634 Document pyp2spec is available in Fedora 2025-02-11 14:20:10 +01:00
Karolina Surma 6750d3fd9e Split the megafunction create_config_contents
The new create_package_from_source takes care of creating the package object
and the "old" create_config_contents only modifies the bits needed for
the full config file.
2025-02-07 19:52:06 +01:00
Karolina Surma db55a78169 More issues found by ruff 2025-02-07 19:52:06 +01:00
Karolina Surma 706096ef12 The fallback value of version is an empty string, not None 2025-02-07 19:52:06 +01:00
Karolina Surma 605d008762 Rework resolve_url so it's more legible 2025-02-07 19:52:06 +01:00
Karolina Surma 1376e0ba49 Raise an exception if there's no package name in metadata
That's an error state that can't be allowed to proceed further.
2025-02-07 19:52:06 +01:00
Karolina Surma e4795439e7 Bump packaging to at least 24.2 for support of PEP 639
This version is present in Fedora 41, 42, 43.
The compat bits could be removed.
2025-02-07 19:52:06 +01:00
Karolina Surma c8d456d577 Raise an exception when source is anything else than PyPI 2025-02-07 19:52:06 +01:00
Karolina Surma eb09c25aca Use type annotations for clearer understanding of the functions
Adapt ruff as a linter for the job.
2025-02-07 19:52:06 +01:00
Karolina Surma 77491e8a8e Define the package information in a dataclass
This serves as a sort of contract, as opposed to a plain dictionary.
This enables control over all of the attributes and makes it reasonably
sure nothing gets unexpectedly mixed in.
2025-02-07 13:43:41 +01:00
Karolina Surma a7d50639ee Remove rogue debug print 2025-01-29 16:37:10 +01:00
Karolina Surma 343dbf2603 Remove rogue imports 2025-01-24 17:03:37 +01:00
Karolina Surma 0fd8122e6c Unify two very similar functions 2025-01-24 17:03:22 +01:00
Karolina Surma 30d5e96947 Look for the well-known project URL keys
According to the official specification:
https://packaging.python.org/en/latest/specifications/well-known-project-urls/
project URLs' labels can be normalized and then searched for the
matches.
Attempt to find "homepage" and "source" first, and only return other
project URL values if these are not found.
2025-01-24 17:02:08 +01:00
Karolina Surma 833c8e7f8f Rename the functions to clearly indicate what they do 2025-01-17 15:14:50 +01:00
Karolina Surma ca996379a7 Correct the syntax and make linter happy 2025-01-10 17:35:13 +01:00
Karolina Surma e3161dfde1 Test with Python 3.14 2025-01-10 17:19:24 +01:00
Karolina Surma 20138c9bd6 Wrap click.secho to predefined functions - better readability 2025-01-10 17:12:23 +01:00
Karolina Surma b39221c813 pyp2conf: create a package based on core metadata if available
The refactor contains changes:
- core metadata coming from the Metadata file are the canonical source
  of truth to gather package info
- the archive metadata are still obtained from PyPI API, as core
  metadata don't include any information about them
- OOP approach is refactored to the functional one to achieve clearer
  design of multiple data sources and better testability of the
  particular functions
- pyp2conf now contains only the logic of the actual data assembly, all
  the helper methods are moved to the pypi_loaders, utils and
  license_processor
2025-01-10 17:11:53 +01:00
Karolina Surma 68ba134aa9 Bump version 0.11.0 -> 0.11.1 2024-11-21 17:55:12 +01:00
Karolina Surma cdd333ec7d Bring back the legacy sdist filename processing
(Effectively revert the removals done to implement PEP 625).
The removal was too haste and broke the users.

This reverts commit 9747b76c4f
and builds on top of the changes in between.
2024-11-21 17:55:12 +01:00
Karolina Surma a724cdb771 Bump version 0.10.0 -> 0.11.0 2024-10-22 19:08:24 +02:00
Karolina Surma 706ce6bbe1 Ignore all files generated by the tool 2024-10-22 19:08:24 +02:00
Karolina Surma 840324354f Test all the conf2spec functions 2024-10-22 19:08:24 +02:00
Karolina Surma 59b51e13f5 Move the name normalizing functions to utils
They are used in both scripts.
2024-10-22 19:08:24 +02:00
Karolina Surma 99fc8ca32f Separate loading of the config file from validating
This will help with testing the particular conf2spec functions.
2024-10-22 19:08:24 +02:00
Karolina Surma 5d0cba4788 Move RPM-specific computations to conf2spec
pyp2conf shouldn't be so heavy with RPM-specific data.
The data stored in the config file are the ones read from either the
PyPI API or Metadata file.
Everything related to transformations to specfiles is now stored in
conf2spec. It reads the config data and converts them to RPM-specific
format.
Ideally, if pyproject-rpm-macros become obsolete and a new system comes
in place, the only changes would be applicable on the side of conf2spec.
2024-10-22 17:52:24 +02:00
Karolina Surma 9747b76c4f Implement PEP 625
The sdist filenames are now standardized:
- distribution name is normalized similarly to the project names, but
  with "_" instead of "-"
- version string is expected to be PEP 440 compliant
- the supported file extension is tar.gz, zip is gone
2024-10-22 17:52:24 +02:00
Karolina Surma 942fd407a6 Update the example specfile output 2024-10-22 17:52:24 +02:00
Karolina Surma dde452901a Remove the obsolete code regarding description
A placeholder is always filled in.
2024-10-22 17:52:24 +02:00
Karolina Surma e997edff90 No more raising errors when detected licenses are invalid 2024-10-22 17:52:24 +02:00
Karolina Surma db7f375440 Update the test configs and expected outputs
Always test the whole config contents even if the test is about a single
feature.
This ensures no regressions are accidentally introduced and ensures
wanted updates when recreating cassettes.
2024-10-22 17:52:24 +02:00