Browse code

don't use pip -e install for libraries

libraries in openstack shouldn't be installed editable, as it
causes all manner of issues (especially complicated by the use
of namespace packages). Install these globally as part of the
devstack installation process.

Change-Id: I11acb169e74069be0618e57496ff342f9e788493

Sean Dague authored on 2014/03/31 23:35:43
Showing 5 changed files
... ...
@@ -35,6 +35,7 @@ source $TOP_DIR/lib/rpc_backend
35 35
 
36 36
 source $TOP_DIR/lib/oslo
37 37
 source $TOP_DIR/lib/tls
38
+
38 39
 source $TOP_DIR/lib/horizon
39 40
 source $TOP_DIR/lib/keystone
40 41
 source $TOP_DIR/lib/glance
... ...
@@ -76,7 +77,6 @@ if [[ -d $TOP_DIR/extras.d ]]; then
76 76
 fi
77 77
 
78 78
 # Clean projects
79
-cleanup_oslo
80 79
 cleanup_cinder
81 80
 cleanup_glance
82 81
 cleanup_keystone
... ...
@@ -1269,12 +1269,26 @@ function safe_chmod() {
1269 1269
     _safe_permission_operation chmod $@
1270 1270
 }
1271 1271
 
1272
+# this should be used if you want to install globally, all libraries should
1273
+# use this, especially *oslo* ones
1274
+function setup_install {
1275
+    local project_dir=$1
1276
+    setup_package_with_req_sync $project_dir
1277
+}
1278
+
1279
+# this should be used for projects which run services, like all services
1280
+function setup_develop {
1281
+    local project_dir=$1
1282
+    setup_package_with_req_sync $project_dir -e
1283
+}
1284
+
1272 1285
 # ``pip install -e`` the package, which processes the dependencies
1273 1286
 # using pip before running `setup.py develop`
1274 1287
 # Uses globals ``STACK_USER``, ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``
1275 1288
 # setup_develop directory
1276
-function setup_develop() {
1289
+function setup_package_with_req_sync() {
1277 1290
     local project_dir=$1
1291
+    local flags=$2
1278 1292
 
1279 1293
     echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
1280 1294
 
... ...
@@ -1287,9 +1301,11 @@ function setup_develop() {
1287 1287
             $SUDO_CMD python update.py $project_dir)
1288 1288
     fi
1289 1289
 
1290
-    pip_install -e $project_dir
1290
+    pip_install $flags $project_dir
1291 1291
     # ensure that further actions can do things like setup.py sdist
1292
-    safe_chown -R $STACK_USER $1/*.egg-info
1292
+    if [[ "$flags" == "-e" ]]; then
1293
+        safe_chown -R $STACK_USER $1/*.egg-info
1294
+    fi
1293 1295
 
1294 1296
     # Undo requirements changes, if we made them
1295 1297
     if [ $update_requirements -eq 0 ]; then
... ...
@@ -45,7 +45,7 @@ function install_infra() {
45 45
 
46 46
     # Install pbr
47 47
     git_clone $PBR_REPO $PBR_DIR $PBR_BRANCH
48
-    setup_develop $PBR_DIR
48
+    setup_install $PBR_DIR
49 49
 }
50 50
 
51 51
 # Restore xtrace
... ...
@@ -27,15 +27,13 @@ OSLOMSG_DIR=$DEST/oslo.messaging
27 27
 
28 28
 # install_oslo() - Collect source and prepare
29 29
 function install_oslo() {
30
-    # TODO(sdague): remove this once we get to Icehouse, this just makes
31
-    # for a smoother transition of existing users.
32 30
     cleanup_oslo
33 31
 
34 32
     git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
35
-    setup_develop $OSLOCFG_DIR
33
+    setup_install $OSLOCFG_DIR
36 34
 
37 35
     git_clone $OSLOMSG_REPO $OSLOMSG_DIR $OSLOMSG_BRANCH
38
-    setup_develop $OSLOMSG_DIR
36
+    setup_install $OSLOMSG_DIR
39 37
 }
40 38
 
41 39
 # cleanup_oslo() - purge possibly old versions of oslo
42 40
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+# lib/stackforge
1
+#
2
+# Functions to install stackforge libraries that we depend on so
3
+# that we can try their git versions during devstack gate.
4
+#
5
+# This is appropriate for python libraries that release to pypi and are
6
+# expected to be used beyond OpenStack like, but are requirements
7
+# for core services in global-requirements.
8
+#
9
+#     * wsme
10
+#     * pecan
11
+#
12
+# This is not appropriate for stackforge projects which are early stage
13
+# OpenStack tools
14
+
15
+# Dependencies:
16
+# ``functions`` file
17
+
18
+# ``stack.sh`` calls the entry points in this order:
19
+#
20
+# install_stackforge
21
+
22
+# Save trace setting
23
+XTRACE=$(set +o | grep xtrace)
24
+set +o xtrace
25
+
26
+
27
+# Defaults
28
+# --------
29
+WSME_DIR=$DEST/wsme
30
+PECAN_DIR=$DEST/pecan
31
+
32
+# Entry Points
33
+# ------------
34
+
35
+# install_stackforge() - Collect source and prepare
36
+function install_stackforge {
37
+    # TODO(sdague): remove this once we get to Icehouse, this just makes
38
+    # for a smoother transition of existing users.
39
+    cleanup_stackforge
40
+
41
+    git_clone $WSME_REPO $WSME_DIR $WSME_BRANCH
42
+    setup_package $WSME_DIR
43
+
44
+    git_clone $PECAN_REPO $PECAN_DIR $PECAN_BRANCH
45
+    setup_package $PECAN_DIR
46
+}
47
+
48
+# cleanup_stackforge() - purge possibly old versions of stackforge libraries
49
+function cleanup_stackforge {
50
+    # this means we've got an old version installed, lets get rid of it
51
+    # otherwise python hates itself
52
+    for lib in wsme pecan; do
53
+        if ! python -c "import $lib" 2>/dev/null; then
54
+            echo "Found old $lib... removing to ensure consistency"
55
+            local PIP_CMD=$(get_pip_command)
56
+            pip_install $lib
57
+            sudo $PIP_CMD uninstall -y $lib
58
+        fi
59
+    done
60
+}
61
+
62
+# Restore xtrace
63
+$XTRACE
64
+
65
+# Local variables:
66
+# mode: shell-script
67
+# End: