Eliminated build.sh and sed in favor of a common setup_header.py script which
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 7 May 2014 14:32:54 +0000 (10:32 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 7 May 2014 14:32:54 +0000 (10:32 -0400)
call popen to get the git revision directly.  Removed spurious server_pid > 0
and added except Execption: on run_test_server.py.

sdk/python/.gitignore
sdk/python/build.sh [deleted file]
sdk/python/run_test_server.py
sdk/python/setup.py [new file with mode: 0644]
sdk/python/setup.py.src
sdk/python/setup_fuse.py [moved from sdk/python/setup_fuse.py.src with 64% similarity]
sdk/python/setup_header.py [new file with mode: 0644]

index 6d57899d2e27f0ce355062466800ad11f6697b35..7f9c17b7433633f9447d0b3cc575fbe5c7182bca 100644 (file)
@@ -2,4 +2,3 @@
 /dist/
 /*.egg-info
 /tmp
-setup.py
diff --git a/sdk/python/build.sh b/sdk/python/build.sh
deleted file mode 100755 (executable)
index ac8ec47..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/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
-sed "s|%%MINOR_VERSION%%|$minor_version|" < setup_fuse.py.src > setup_fuse.py
index 511f2e6c21683fc1fbff3430cf015c21438334a4..b4886f0c8af6d474d5ae2677384fb7d22ed31b82 100644 (file)
@@ -19,8 +19,8 @@ def find_server_pid(PID_PATH):
         try:
             with open(PID_PATH, 'r') as f:
                 server_pid = int(f.read())
-            good_pid = (server_pid > 0) and (os.kill(server_pid, 0) == None)
-        except:
+            good_pid = (os.kill(server_pid, 0) == None)
+        except Exception:
             good_pid = False
 
     if not good_pid:
diff --git a/sdk/python/setup.py b/sdk/python/setup.py
new file mode 100644 (file)
index 0000000..e8bcb5c
--- /dev/null
@@ -0,0 +1,26 @@
+from setuptools import setup
+import setup_header
+
+setup(name='arvados-python-client',
+      version='0.1.' + setup_header.minor_version,
+      description='Arvados client library',
+      author='Arvados',
+      author_email='info@arvados.org',
+      url="https://arvados.org",
+      download_url="https://github.com/curoverse/arvados.git",
+      license='Apache 2.0',
+      packages=['arvados'],
+      scripts=[
+        'bin/arv-get',
+        'bin/arv-put',
+        'bin/arv-ls',
+        'bin/arv-normalize',
+        ],
+      install_requires=[
+        'python-gflags',
+        'google-api-python-client',
+        'httplib2',
+        'urllib3',
+        'ws4py'
+        ],
+      zip_safe=False)
index 807327c3a511d91d0c99cd166e6c2808f11fe0ba..fbb8c52337dcbe9fd22ddcdab3e1f3af3d7bf086 100644 (file)
@@ -1,12 +1,3 @@
-from setuptools import setup
-import shutil
-
-minor_version = '%%MINOR_VERSION%%'
-
-# setup.py and setup_fuse.py both share the build/ directory (argh!) so
-# make sure to delete it to avoid scooping up the wrong files.
-shutil.rmtree('build')
-
 setup(name='arvados-python-client',
       version='0.1.' + minor_version,
       description='Arvados client library',
similarity index 64%
rename from sdk/python/setup_fuse.py.src
rename to sdk/python/setup_fuse.py
index 9e191fbb2416cbeff07f6417f563209e2e427d74..4c759c11e99b2d0f50cef5246a4e946a622b34f0 100644 (file)
@@ -1,15 +1,8 @@
 from setuptools import setup
-import distutils
-import shutil
-
-minor_version = '%%MINOR_VERSION%%'
-
-# setup.py and setup_fuse.py both share the build/ directory (argh!) so
-# make sure to delete it to avoid scooping up the wrong files.
-shutil.rmtree('build')
+import setup_header
 
 setup(name='arvados-fuse-driver',
-      version='0.1.' + minor_version,
+      version='0.1.' + setup_header.minor_version,
       description='Arvados FUSE driver',
       author='Arvados',
       author_email='info@arvados.org',
diff --git a/sdk/python/setup_header.py b/sdk/python/setup_header.py
new file mode 100644 (file)
index 0000000..c97f94d
--- /dev/null
@@ -0,0 +1,11 @@
+import shutil
+import os
+import sys
+
+with os.popen("git log --format=format:%ct.%h -n1 .") as m:
+    minor_version=m.read()
+
+# setup.py and setup_fuse.py both share the build/ directory (argh!) so
+# make sure to delete it to avoid scooping up the wrong files.
+build_dir = os.path.join(os.path.dirname(sys.argv[0]), 'build')
+shutil.rmtree(build_dir, ignore_errors=True)