[pygobject] setup.py: Add a ".dev" suffix to the version for pre-releases. Fixes #190
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] setup.py: Add a ".dev" suffix to the version for pre-releases. Fixes #190
- Date: Mon, 9 Apr 2018 10:26:28 +0000 (UTC)
commit 91c495d7460cdfd889265531b37c153bdfa714e5
Author: Christoph Reiter <reiter christoph gmail com>
Date: Mon Apr 9 12:20:38 2018 +0200
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.
setup.py | 18 ++++++++++++++++--
1 file 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"],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]