Improve python sdk package building to allow for easy distribution via
authorWard Vandewege <ward@curoverse.com>
Wed, 19 Feb 2014 02:33:37 +0000 (21:33 -0500)
committerWard Vandewege <ward@curoverse.com>
Wed, 19 Feb 2014 02:33:37 +0000 (21:33 -0500)
pypi.

sdk/python/.gitignore
sdk/python/build.sh [new file with mode: 0755]
sdk/python/setup.py.src [moved from sdk/python/setup.py with 78% similarity]

index 7f9c17b7433633f9447d0b3cc575fbe5c7182bca..6d57899d2e27f0ce355062466800ad11f6697b35 100644 (file)
@@ -2,3 +2,4 @@
 /dist/
 /*.egg-info
 /tmp
+setup.py
diff --git a/sdk/python/build.sh b/sdk/python/build.sh
new file mode 100755 (executable)
index 0000000..4808954
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Apparently the only reliable way to distribute Python packages with pypi and
+# install them via pip is as source packages (sdist).
+#
+# That means that setup.py is run on the system the package is being installed on,
+# outside of the Arvados git tree.
+#
+# In turn, this means that we can not build the minor_version on the fly when
+# setup.py is being executed. Instead, we use this script to generate a 'static'
+# version of setup.py which will can be distributed via pypi.
+
+minor_version=`git log --format=format:%ct.%h -n1 .`
+
+sed "s|%%MINOR_VERSION%%|$minor_version|" < setup.py.src > setup.py
+
similarity index 78%
rename from sdk/python/setup.py
rename to sdk/python/setup.py.src
index d366e768dd2dfb9b8ef85d4e6bb22d2684b1db95..bb9e4769e7871c66abc5cdb30038cb214f7987c2 100644 (file)
@@ -1,15 +1,15 @@
 from setuptools import setup
 import subprocess
 
-minor_version = subprocess.check_output(
-    ['git', 'log', '--format=format:%ct.%h', '-n1', '.'])
+minor_version = '%%MINOR_VERSION%%'
 
 setup(name='arvados-python-client',
       version='0.1.' + minor_version,
       description='Arvados client library',
       author='Arvados',
       author_email='info@arvados.org',
-      url="https://github.com/curoverse/arvados.git",
+      url="https://arvados.org",
+      download_url="https://github.com/curoverse/arvados.git",
       license='Apache 2.0',
       packages=['arvados'],
       scripts=[