Browse code

Merge "Move setup_develop() to common"

Jenkins authored on 2014/02/27 21:32:54
Showing 2 changed files
... ...
@@ -44,60 +44,6 @@ function cleanup_tmp {
44 44
 }
45 45
 
46 46
 
47
-# ``pip install -e`` the package, which processes the dependencies
48
-# using pip before running `setup.py develop`
49
-#
50
-# Updates the dependencies in project_dir from the
51
-# openstack/requirements global list before installing anything.
52
-#
53
-# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
54
-# setup_develop directory
55
-function setup_develop() {
56
-    local project_dir=$1
57
-
58
-    echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
59
-
60
-    # Don't update repo if local changes exist
61
-    # Don't use buggy "git diff --quiet"
62
-    (cd $project_dir && git diff --exit-code >/dev/null)
63
-    local update_requirements=$?
64
-
65
-    if [ $update_requirements -eq 0 ]; then
66
-        (cd $REQUIREMENTS_DIR; \
67
-            $SUDO_CMD python update.py $project_dir)
68
-    fi
69
-
70
-    setup_develop_no_requirements_update $project_dir
71
-
72
-    # We've just gone and possibly modified the user's source tree in an
73
-    # automated way, which is considered bad form if it's a development
74
-    # tree because we've screwed up their next git checkin. So undo it.
75
-    #
76
-    # However... there are some circumstances, like running in the gate
77
-    # where we really really want the overridden version to stick. So provide
78
-    # a variable that tells us whether or not we should UNDO the requirements
79
-    # changes (this will be set to False in the OpenStack ci gate)
80
-    if [ $UNDO_REQUIREMENTS = "True" ]; then
81
-        if [ $update_requirements -eq 0 ]; then
82
-            (cd $project_dir && git reset --hard)
83
-        fi
84
-    fi
85
-}
86
-
87
-
88
-# ``pip install -e`` the package, which processes the dependencies
89
-# using pip before running `setup.py develop`
90
-# Uses globals ``STACK_USER``
91
-# setup_develop_no_requirements_update directory
92
-function setup_develop_no_requirements_update() {
93
-    local project_dir=$1
94
-
95
-    pip_install -e $project_dir
96
-    # ensure that further actions can do things like setup.py sdist
97
-    safe_chown -R $STACK_USER $1/*.egg-info
98
-}
99
-
100
-
101 47
 # Retrieve an image from a URL and upload into Glance.
102 48
 # Uses the following variables:
103 49
 #
... ...
@@ -1212,6 +1212,58 @@ function pip_install {
1212 1212
         && $SUDO_PIP rm -rf ${pip_build_tmp}
1213 1213
 }
1214 1214
 
1215
+# ``pip install -e`` the package, which processes the dependencies
1216
+# using pip before running `setup.py develop`
1217
+#
1218
+# Updates the dependencies in project_dir from the
1219
+# openstack/requirements global list before installing anything.
1220
+#
1221
+# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
1222
+# setup_develop directory
1223
+function setup_develop() {
1224
+    local project_dir=$1
1225
+
1226
+    echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
1227
+
1228
+    # Don't update repo if local changes exist
1229
+    # Don't use buggy "git diff --quiet"
1230
+    (cd $project_dir && git diff --exit-code >/dev/null)
1231
+    local update_requirements=$?
1232
+
1233
+    if [ $update_requirements -eq 0 ]; then
1234
+        (cd $REQUIREMENTS_DIR; \
1235
+            $SUDO_CMD python update.py $project_dir)
1236
+    fi
1237
+
1238
+    setup_develop_no_requirements_update $project_dir
1239
+
1240
+    # We've just gone and possibly modified the user's source tree in an
1241
+    # automated way, which is considered bad form if it's a development
1242
+    # tree because we've screwed up their next git checkin. So undo it.
1243
+    #
1244
+    # However... there are some circumstances, like running in the gate
1245
+    # where we really really want the overridden version to stick. So provide
1246
+    # a variable that tells us whether or not we should UNDO the requirements
1247
+    # changes (this will be set to False in the OpenStack ci gate)
1248
+    if [ $UNDO_REQUIREMENTS = "True" ]; then
1249
+        if [ $update_requirements -eq 0 ]; then
1250
+            (cd $project_dir && git reset --hard)
1251
+        fi
1252
+    fi
1253
+}
1254
+
1255
+# ``pip install -e`` the package, which processes the dependencies
1256
+# using pip before running `setup.py develop`
1257
+# Uses globals ``STACK_USER``
1258
+# setup_develop_no_requirements_update directory
1259
+function setup_develop_no_requirements_update() {
1260
+    local project_dir=$1
1261
+
1262
+    pip_install -e $project_dir
1263
+    # ensure that further actions can do things like setup.py sdist
1264
+    safe_chown -R $STACK_USER $1/*.egg-info
1265
+}
1266
+
1215 1267
 
1216 1268
 # Service Functions
1217 1269
 # =================