Skip to content

Just a useful abstaraction for referencing packages in your package managers and build systems.

License

Notifications You must be signed in to change notification settings

prebuilder/PackageRef.py

Repository files navigation

PackageRef.py Unlicensed work

GitLab Build Status GitLab Coverage Coveralls Coverage GitHub Actions Libraries.io Status Code style: antiflash

Just represents a reference to a package in a unified way.

Let's call a "string name" a name visible in a package manager, like sqlite3:amd64.

  • BasePackageRef - just a name + architecture. Also stores the object describing how to handle "incompatible" part of version in versionPostfix. There is a practice to include some parts of versions into package name to allow simultaneous installation of incompatible versions. You just set the count of these components. In subclasses it is allowed to add a version. But usually you know this count before you know the version, because whether this package uses that trick or not is a matter of convention.

  • PackageRef - BasePackageRef + group. Group is the way to name packages. For example in Debian deb packages for python3 begin from python3- prefix. Different distros have different conventions. So we store the name and group separately and can transform a "string name" into a PackageRef automatically. Doing this is the goal of other packages. This one is only about storing package refs.

  • VersionedPackageRef - adds a version to a package. When transformed into a "string name", versionPostfix will append this count of version components to the end of name. To get sqlite3 just use VersionedPackageRef("sqlite", version=AnyVer("3.29.0"), versionPostfix=1);

All the stuff is hashable (can be used as a key in dict) and clonable (ref.clone() returns a clone). It is mutable, but hashable, so just use with care.

All the stuff is upgradeable. You can upgrade BasePackageRef to VersionedPackageRef using ref.clone(cls=VersionedPackageRef, version=AnyVer(pkgDepSpc.version)).

All the stuff is downgradeable. You can downgrade VersionedPackageRef to BasePackageRef using ref.clone(cls=BasePackageRef).

You can downgrade to the immediate base class using ref.downgrade.

Requirements

  • Python >=3.4. Python 2 is dead, stop raping its corpse. Use 2to3 with manual postprocessing to migrate incompatible code to 3. It shouldn't take so much time. For unit-testing you need Python 3.6+ or PyPy3 because their dict is ordered and deterministic. Python 3 is also semi-dead, 3.7 is the last minor release in 3.

About

Just a useful abstaraction for referencing packages in your package managers and build systems.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages