]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix for bug 900316
authorBrad Hall <brad@nicira.com>
Mon, 5 Dec 2011 17:52:24 +0000 (09:52 -0800)
committerBrad Hall <brad@nicira.com>
Mon, 5 Dec 2011 17:53:43 +0000 (09:53 -0800)
This fixes the --venv and --user install options as well as the path in the
cli script.

Change-Id: Ie9f265ca248db3d91ff92b7dc3090e1bfdbb0eb6

setup.py
setup_client.py

index 78334102f8f831bbfae6ed48c39fe0f499e5e23f..68c7a4599aa4296eb7f9d8a1439758f151d1d567 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -20,12 +20,21 @@ def clean_path(dirty):
 
 
 def script_dir():
+    global RELATIVE
     script_dir = '/usr/sbin/'
     if RELATIVE:
         script_dir = 'usr/sbin/'
     return script_dir
 
 
+def etc_dir():
+    global RELATIVE
+    etc_dir = '/etc/'
+    if RELATIVE:
+        etc_dir = 'etc/'
+    return etc_dir
+
+
 def create_parser():
     """Setup the option parser"""
     usagestr = "Usage: %prog [OPTIONS] <command> [args]"
@@ -49,7 +58,7 @@ def create_parser():
 def install_packages(options, args=None):
     """Builds and installs packages"""
     # Start building a command list
-    cmd = ['pip', 'install']
+    cmd = ['python']
 
     # If no options, just a regular install.  If venv, create, prepare and
     # install in venv.  If --user install in user's local dir.  Usually
@@ -60,9 +69,7 @@ def install_packages(options, args=None):
         else:
             install_venv.create_virtualenv(install_pip=False)
         install_venv.install_dependencies()
-        cmd.extend(['-E', install_venv.VENV])
-    elif options.user:
-        cmd.append('--user')
+        cmd.insert(0, "tools/with_venv.sh")
 
     # Install packages
     # TODO(Tyler) allow users to pass in packages in cli
@@ -71,11 +78,20 @@ def install_packages(options, args=None):
         # Each package needs its own command list, and it needs the path
         # in the correct place (after "pip install")
         pcmd = deepcopy(cmd)
-        pcmd.insert(2, path.join(ROOT, clean_path(package)))
+        pcmd.extend(["setup_%s.py" % package, "install"])
+
+        if options.venv:
+            pcmd.append("--root=%s" % install_venv.VENV)
+
+        if options.user:
+            pcmd.append('--user')
+
+        if package is 'client':
+            pcmd.append("--install-scripts=%s" % script_dir())
 
         if package is 'server':
-            pcmd.append("--install-option=--install-scripts=%s" %\
-                        script_dir())
+            pcmd.append("--install-scripts=%s" % script_dir())
+            pcmd.append("--install-data=%s" % etc_dir())
         print pcmd
         install_venv.run_command(pcmd)
         print "done."
@@ -134,6 +150,7 @@ def clean_packages(options, args):
 
 def main():
     """Main Build script for Quantum"""
+    global RELATIVE
     options, cmd, args = create_parser()
 
     if options.user:
index 43591e2036be7c2e922707e5384b45ef175961a6..8a39e0932bdfd5b75b8ba76af010a07a9ffd768e 100644 (file)
@@ -50,7 +50,7 @@ setup(
     eager_resources=EagerResources,
     entry_points={
         'console_scripts': [
-            'quantum = quantum.cli:main'
+            'quantum = quantum.client.cli:main'
         ]
     },
 )