Browse code

Merge "Support extra dependencies when setup_develop"

Jenkins authored on 2016/01/07 05:17:12
Showing 1 changed files
... ...
@@ -242,15 +242,31 @@ function setup_dev_lib {
242 242
 
243 243
 # this should be used if you want to install globally, all libraries should
244 244
 # use this, especially *oslo* ones
245
+#
246
+# setup_install project_dir [extras]
247
+# project_dir: directory of project repo (e.g., /opt/stack/keystone)
248
+# extras: comma-separated list of optional dependencies to install
249
+#         (e.g., ldap,memcache).
250
+#         See http://docs.openstack.org/developer/pbr/#extra-requirements
251
+# The command is like "pip install <project_dir>[<extras>]"
245 252
 function setup_install {
246 253
     local project_dir=$1
247
-    setup_package_with_constraints_edit $project_dir
254
+    local extras=$2
255
+    _setup_package_with_constraints_edit $project_dir "" $extras
248 256
 }
249 257
 
250 258
 # this should be used for projects which run services, like all services
259
+#
260
+# setup_develop project_dir [extras]
261
+# project_dir: directory of project repo (e.g., /opt/stack/keystone)
262
+# extras: comma-separated list of optional dependencies to install
263
+#         (e.g., ldap,memcache).
264
+#         See http://docs.openstack.org/developer/pbr/#extra-requirements
265
+# The command is like "pip install -e <project_dir>[<extras>]"
251 266
 function setup_develop {
252 267
     local project_dir=$1
253
-    setup_package_with_constraints_edit $project_dir -e
268
+    local extras=$2
269
+    _setup_package_with_constraints_edit $project_dir -e $extras
254 270
 }
255 271
 
256 272
 # determine if a project as specified by directory is in
... ...
@@ -272,10 +288,17 @@ function is_in_projects_txt {
272 272
 # install this package we get the from source version.
273 273
 #
274 274
 # Uses globals ``REQUIREMENTS_DIR``
275
-# setup_develop directory
276
-function setup_package_with_constraints_edit {
275
+# _setup_package_with_constraints_edit project_dir flags [extras]
276
+# project_dir: directory of project repo (e.g., /opt/stack/keystone)
277
+# flags: pip CLI options/flags
278
+# extras: comma-separated list of optional dependencies to install
279
+#         (e.g., ldap,memcache).
280
+#         See http://docs.openstack.org/developer/pbr/#extra-requirements
281
+# The command is like "pip install <flags> <project_dir>[<extras>]"
282
+function _setup_package_with_constraints_edit {
277 283
     local project_dir=$1
278 284
     local flags=$2
285
+    local extras=$3
279 286
 
280 287
     if [ -n "$REQUIREMENTS_DIR" ]; then
281 288
         # Constrain this package to this project directory from here on out.
... ...
@@ -286,19 +309,38 @@ function setup_package_with_constraints_edit {
286 286
             "$flags file://$project_dir#egg=$name"
287 287
     fi
288 288
 
289
-    setup_package $project_dir $flags
289
+    setup_package $project_dir "$flags" $extras
290 290
 
291 291
 }
292 292
 
293 293
 # ``pip install -e`` the package, which processes the dependencies
294 294
 # using pip before running `setup.py develop`
295
+#
295 296
 # Uses globals ``STACK_USER``
296
-# setup_develop_no_requirements_update directory
297
+# setup_package project_dir [flags] [extras]
298
+# project_dir: directory of project repo (e.g., /opt/stack/keystone)
299
+# flags: pip CLI options/flags
300
+# extras: comma-separated list of optional dependencies to install
301
+#         (e.g., ldap,memcache).
302
+#         See http://docs.openstack.org/developer/pbr/#extra-requirements
303
+# The command is like "pip install <flags> <project_dir>[<extras>]"
297 304
 function setup_package {
298 305
     local project_dir=$1
299 306
     local flags=$2
307
+    local extras=$3
308
+
309
+    # if the flags variable exists, and it doesn't look like a flag,
310
+    # assume it's actually the extras list.
311
+    if [[ -n "$flags" && -z "$extras" && ! "$flags" =~ ^-.* ]]; then
312
+        extras=$flags
313
+        flags=""
314
+    fi
315
+
316
+    if [[ ! -z "$extras" ]]; then
317
+        extras="[$extras]"
318
+    fi
300 319
 
301
-    pip_install $flags $project_dir
320
+    pip_install $flags "$project_dir$extras"
302 321
     # ensure that further actions can do things like setup.py sdist
303 322
     if [[ "$flags" == "-e" ]]; then
304 323
         safe_chown -R $STACK_USER $1/*.egg-info