diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-09 12:20:38 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-09 12:20:38 +0200 |
commit | 91c495d7460cdfd889265531b37c153bdfa714e5 (patch) | |
tree | 020e7c9e86052cf5e6d0ef2010c73b3641e1c8bb | |
parent | 71eadb88fe75bfda66d449f46cde4b1eb958e4f4 (diff) | |
download | pygobject-91c495d7460cdfd889265531b37c153bdfa714e5.tar.gz |
setup.py: Add a ".dev" suffix to the version for pre-releases. Fixes #190
PEP440 defines versions with a .dev suffix as pre-releases and pushing them
to PyPI makes them installable when --pre is passed to pip.
In case of pkg-config and GNOME release tarballs we keep using the old
version format.
-rwxr-xr-x | setup.py | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -46,6 +46,11 @@ PYCAIRO_VERSION_REQUIRED = "1.11.1" LIBFFI_VERSION_REQUIRED = "3.0" +def is_dev_version(): + version = tuple(map(int, PYGOBJECT_VERISON.split("."))) + return version[1] % 2 != 0 + + def get_command_class(name): # Returns the right class for either distutils or setuptools return Distribution({}).get_command_class(name) @@ -267,6 +272,9 @@ class sdist_gnome(Command): pass def run(self): + # Don't use PEP 440 pre-release versions for GNOME releases + self.distribution.metadata.version = PYGOBJECT_VERISON + dist_dir = tempfile.mkdtemp() try: cmd = self.reinitialize_command("sdist") @@ -1014,7 +1022,7 @@ class install_pkgconfig(Command): "includedir": "${prefix}/include", "datarootdir": "${prefix}/share", "datadir": "${datarootdir}", - "VERSION": self.distribution.get_version(), + "VERSION": PYGOBJECT_VERISON, } for key, value in config.items(): content = content.replace("@%s@" % key, value) @@ -1071,9 +1079,15 @@ def main(): define_macros=[("PY_SSIZE_T_CLEAN", None)], ) + version = pkginfo["Version"] + if is_dev_version(): + # This makes it a PEP 440 pre-release and pip will only install it from + # PyPI in case --pre is passed. + version += ".dev" + setup( name=pkginfo["Name"], - version=pkginfo["Version"], + version=version, description=pkginfo["Summary"], url=pkginfo["Home-page"], author=pkginfo["Author"], |