Browse code

Move setup_develop() to common

It's in the wrong place for current Grenade

Change-Id: Ia670198332af5945a56d708cd83d9239df0c2287

Dean Troyer authored on 2014/02/18 03:57:55
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
 #
... ...
@@ -1130,6 +1130,58 @@ function pip_install {
1130 1130
         && $SUDO_PIP rm -rf ${pip_build_tmp}
1131 1131
 }
1132 1132
 
1133
+# ``pip install -e`` the package, which processes the dependencies
1134
+# using pip before running `setup.py develop`
1135
+#
1136
+# Updates the dependencies in project_dir from the
1137
+# openstack/requirements global list before installing anything.
1138
+#
1139
+# Uses globals ``TRACK_DEPENDS``, ``REQUIREMENTS_DIR``, ``UNDO_REQUIREMENTS``
1140
+# setup_develop directory
1141
+function setup_develop() {
1142
+    local project_dir=$1
1143
+
1144
+    echo "cd $REQUIREMENTS_DIR; $SUDO_CMD python update.py $project_dir"
1145
+
1146
+    # Don't update repo if local changes exist
1147
+    # Don't use buggy "git diff --quiet"
1148
+    (cd $project_dir && git diff --exit-code >/dev/null)
1149
+    local update_requirements=$?
1150
+
1151
+    if [ $update_requirements -eq 0 ]; then
1152
+        (cd $REQUIREMENTS_DIR; \
1153
+            $SUDO_CMD python update.py $project_dir)
1154
+    fi
1155
+
1156
+    setup_develop_no_requirements_update $project_dir
1157
+
1158
+    # We've just gone and possibly modified the user's source tree in an
1159
+    # automated way, which is considered bad form if it's a development
1160
+    # tree because we've screwed up their next git checkin. So undo it.
1161
+    #
1162
+    # However... there are some circumstances, like running in the gate
1163
+    # where we really really want the overridden version to stick. So provide
1164
+    # a variable that tells us whether or not we should UNDO the requirements
1165
+    # changes (this will be set to False in the OpenStack ci gate)
1166
+    if [ $UNDO_REQUIREMENTS = "True" ]; then
1167
+        if [ $update_requirements -eq 0 ]; then
1168
+            (cd $project_dir && git reset --hard)
1169
+        fi
1170
+    fi
1171
+}
1172
+
1173
+# ``pip install -e`` the package, which processes the dependencies
1174
+# using pip before running `setup.py develop`
1175
+# Uses globals ``STACK_USER``
1176
+# setup_develop_no_requirements_update directory
1177
+function setup_develop_no_requirements_update() {
1178
+    local project_dir=$1
1179
+
1180
+    pip_install -e $project_dir
1181
+    # ensure that further actions can do things like setup.py sdist
1182
+    safe_chown -R $STACK_USER $1/*.egg-info
1183
+}
1184
+
1133 1185
 
1134 1186
 # Service Functions
1135 1187
 # =================