Skip to content

Commit c615993

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Support extra dependencies when setup_develop"
2 parents 535fcd0 + 0842b81 commit c615993

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

inc/python

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,31 @@ function setup_dev_lib {
242242

243243
# this should be used if you want to install globally, all libraries should
244244
# 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>]"
245252
function setup_install {
246253
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
248256
}
249257

250258
# 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>]"
251266
function setup_develop {
252267
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
254270
}
255271

256272
# determine if a project as specified by directory is in
@@ -272,10 +288,17 @@ function is_in_projects_txt {
272288
# install this package we get the from source version.
273289
#
274290
# Uses globals ``REQUIREMENTS_DIR``
275-
# setup_develop directory
276-
function setup_package_with_constraints_edit {
291+
# _setup_package_with_constraints_edit project_dir flags [extras]
292+
# project_dir: directory of project repo (e.g., /opt/stack/keystone)
293+
# flags: pip CLI options/flags
294+
# extras: comma-separated list of optional dependencies to install
295+
# (e.g., ldap,memcache).
296+
# See http://docs.openstack.org/developer/pbr/#extra-requirements
297+
# The command is like "pip install <flags> <project_dir>[<extras>]"
298+
function _setup_package_with_constraints_edit {
277299
local project_dir=$1
278300
local flags=$2
301+
local extras=$3
279302

280303
if [ -n "$REQUIREMENTS_DIR" ]; then
281304
# Constrain this package to this project directory from here on out.
@@ -286,19 +309,38 @@ function setup_package_with_constraints_edit {
286309
"$flags file://$project_dir#egg=$name"
287310
fi
288311

289-
setup_package $project_dir $flags
312+
setup_package $project_dir "$flags" $extras
290313

291314
}
292315

293316
# ``pip install -e`` the package, which processes the dependencies
294317
# using pip before running `setup.py develop`
318+
#
295319
# Uses globals ``STACK_USER``
296-
# setup_develop_no_requirements_update directory
320+
# setup_package project_dir [flags] [extras]
321+
# project_dir: directory of project repo (e.g., /opt/stack/keystone)
322+
# flags: pip CLI options/flags
323+
# extras: comma-separated list of optional dependencies to install
324+
# (e.g., ldap,memcache).
325+
# See http://docs.openstack.org/developer/pbr/#extra-requirements
326+
# The command is like "pip install <flags> <project_dir>[<extras>]"
297327
function setup_package {
298328
local project_dir=$1
299329
local flags=$2
330+
local extras=$3
331+
332+
# if the flags variable exists, and it doesn't look like a flag,
333+
# assume it's actually the extras list.
334+
if [[ -n "$flags" && -z "$extras" && ! "$flags" =~ ^-.* ]]; then
335+
extras=$flags
336+
flags=""
337+
fi
338+
339+
if [[ ! -z "$extras" ]]; then
340+
extras="[$extras]"
341+
fi
300342

301-
pip_install $flags $project_dir
343+
pip_install $flags "$project_dir$extras"
302344
# ensure that further actions can do things like setup.py sdist
303345
if [[ "$flags" == "-e" ]]; then
304346
safe_chown -R $STACK_USER $1/*.egg-info

0 commit comments

Comments
 (0)