summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-04-09 12:20:38 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-04-09 12:20:38 +0200
commit91c495d7460cdfd889265531b37c153bdfa714e5 (patch)
tree020e7c9e86052cf5e6d0ef2010c73b3641e1c8bb
parent71eadb88fe75bfda66d449f46cde4b1eb958e4f4 (diff)
downloadpygobject-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-xsetup.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index e9810c71..1114b9e5 100755
--- a/setup.py
+++ b/setup.py
@@ -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"],