| ... | ... |
@@ -115,13 +115,12 @@ function check_python3_support_for_package_remote {
|
| 115 | 115 |
echo $classifier |
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 |
-# python3_enabled_for() checks if the service(s) specified as arguments are |
|
| 119 |
-# enabled by the user in ``ENABLED_PYTHON3_PACKAGES``. |
|
| 118 |
+# python3_enabled_for() assumes the service(s) specified as arguments are |
|
| 119 |
+# enabled for python 3 unless explicitly disabled. See python3_disabled_for(). |
|
| 120 | 120 |
# |
| 121 | 121 |
# Multiple services specified as arguments are ``OR``'ed together; the test |
| 122 | 122 |
# is a short-circuit boolean, i.e it returns on the first match. |
| 123 | 123 |
# |
| 124 |
-# Uses global ``ENABLED_PYTHON3_PACKAGES`` |
|
| 125 | 124 |
# python3_enabled_for dir [dir ...] |
| 126 | 125 |
function python3_enabled_for {
|
| 127 | 126 |
local xtrace |
| ... | ... |
@@ -132,7 +131,9 @@ function python3_enabled_for {
|
| 132 | 132 |
local dirs=$@ |
| 133 | 133 |
local dir |
| 134 | 134 |
for dir in ${dirs}; do
|
| 135 |
- [[ ,${ENABLED_PYTHON3_PACKAGES}, =~ ,${dir}, ]] && enabled=0
|
|
| 135 |
+ if ! python3_disabled_for "${dir}"; then
|
|
| 136 |
+ enabled=0 |
|
| 137 |
+ fi |
|
| 136 | 138 |
done |
| 137 | 139 |
|
| 138 | 140 |
$xtrace |
| ... | ... |
@@ -163,42 +164,29 @@ function python3_disabled_for {
|
| 163 | 163 |
return $enabled |
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 |
-# enable_python3_package() adds the repositories passed as argument to the |
|
| 167 |
-# ``ENABLED_PYTHON3_PACKAGES`` list, if they are not already present. |
|
| 166 |
+# enable_python3_package() -- no-op for backwards compatibility |
|
| 168 | 167 |
# |
| 169 | 168 |
# For example: |
| 170 | 169 |
# enable_python3_package nova |
| 171 | 170 |
# |
| 172 |
-# Uses global ``ENABLED_PYTHON3_PACKAGES`` |
|
| 173 | 171 |
# enable_python3_package dir [dir ...] |
| 174 | 172 |
function enable_python3_package {
|
| 175 | 173 |
local xtrace |
| 176 | 174 |
xtrace=$(set +o | grep xtrace) |
| 177 | 175 |
set +o xtrace |
| 178 | 176 |
|
| 179 |
- local tmpsvcs="${ENABLED_PYTHON3_PACKAGES}"
|
|
| 180 |
- local python3 |
|
| 181 |
- for dir in $@; do |
|
| 182 |
- if [[ ,${DISABLED_PYTHON3_PACKAGES}, =~ ,${dir}, ]]; then
|
|
| 183 |
- warn $LINENO "Attempt to enable_python3_package ${dir} when it has been disabled"
|
|
| 184 |
- continue |
|
| 185 |
- fi |
|
| 186 |
- if ! python3_enabled_for $dir; then |
|
| 187 |
- tmpsvcs+=",$dir" |
|
| 188 |
- fi |
|
| 189 |
- done |
|
| 190 |
- ENABLED_PYTHON3_PACKAGES=$(_cleanup_service_list "$tmpsvcs") |
|
| 177 |
+ echo "It is no longer necessary to call enable_python3_package()." |
|
| 191 | 178 |
|
| 192 | 179 |
$xtrace |
| 193 | 180 |
} |
| 194 | 181 |
|
| 195 |
-# disable_python3_package() prepares the services passed as argument to be |
|
| 196 |
-# removed from the ``ENABLED_PYTHON3_PACKAGES`` list, if they are present. |
|
| 182 |
+# disable_python3_package() adds the services passed as argument to |
|
| 183 |
+# the ``DISABLED_PYTHON3_PACKAGES`` list. |
|
| 197 | 184 |
# |
| 198 | 185 |
# For example: |
| 199 | 186 |
# disable_python3_package swift |
| 200 | 187 |
# |
| 201 |
-# Uses globals ``ENABLED_PYTHON3_PACKAGES`` and ``DISABLED_PYTHON3_PACKAGES`` |
|
| 188 |
+# Uses global ``DISABLED_PYTHON3_PACKAGES`` |
|
| 202 | 189 |
# disable_python3_package dir [dir ...] |
| 203 | 190 |
function disable_python3_package {
|
| 204 | 191 |
local xtrace |
| ... | ... |
@@ -206,16 +194,11 @@ function disable_python3_package {
|
| 206 | 206 |
set +o xtrace |
| 207 | 207 |
|
| 208 | 208 |
local disabled_svcs="${DISABLED_PYTHON3_PACKAGES}"
|
| 209 |
- local enabled_svcs=",${ENABLED_PYTHON3_PACKAGES},"
|
|
| 210 | 209 |
local dir |
| 211 | 210 |
for dir in $@; do |
| 212 | 211 |
disabled_svcs+=",$dir" |
| 213 |
- if python3_enabled_for $dir; then |
|
| 214 |
- enabled_svcs=${enabled_svcs//,$dir,/,}
|
|
| 215 |
- fi |
|
| 216 | 212 |
done |
| 217 | 213 |
DISABLED_PYTHON3_PACKAGES=$(_cleanup_service_list "$disabled_svcs") |
| 218 |
- ENABLED_PYTHON3_PACKAGES=$(_cleanup_service_list "$enabled_svcs") |
|
| 219 | 214 |
|
| 220 | 215 |
$xtrace |
| 221 | 216 |
} |
| ... | ... |
@@ -295,7 +278,7 @@ function pip_install {
|
| 295 | 295 |
if python3_disabled_for ${package_dir##*/}; then
|
| 296 | 296 |
echo "Explicitly using $PYTHON2_VERSION version to install $package_dir based on DISABLED_PYTHON3_PACKAGES" |
| 297 | 297 |
elif python3_enabled_for ${package_dir##*/}; then
|
| 298 |
- echo "Explicitly using $PYTHON3_VERSION version to install $package_dir based on ENABLED_PYTHON3_PACKAGES" |
|
| 298 |
+ echo "Using $PYTHON3_VERSION version to install $package_dir based on default behavior" |
|
| 299 | 299 |
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
| 300 | 300 |
cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
| 301 | 301 |
elif [[ -d "$package_dir" ]]; then |
| ... | ... |
@@ -129,15 +129,9 @@ fi |
| 129 | 129 |
# Control whether Python 3 should be used at all. |
| 130 | 130 |
export USE_PYTHON3=$(trueorfalse False USE_PYTHON3) |
| 131 | 131 |
|
| 132 |
-# Control whether Python 3 is enabled for specific services by the |
|
| 133 |
-# base name of the directory from which they are installed. See |
|
| 134 |
-# enable_python3_package to edit this variable and use_python3_for to |
|
| 135 |
-# test membership. |
|
| 136 |
-export ENABLED_PYTHON3_PACKAGES="nova,glance,cinder,uwsgi,python-openstackclient,openstacksdk" |
|
| 137 |
- |
|
| 138 | 132 |
# Explicitly list services not to run under Python 3. See |
| 139 | 133 |
# disable_python3_package to edit this variable. |
| 140 |
-export DISABLED_PYTHON3_PACKAGES="" |
|
| 134 |
+export DISABLED_PYTHON3_PACKAGES="swift" |
|
| 141 | 135 |
|
| 142 | 136 |
# When Python 3 is supported by an application, adding the specific |
| 143 | 137 |
# version of Python 3 to this variable will install the app using that |
| ... | ... |
@@ -12,14 +12,9 @@ source $TOP/tests/unittest.sh |
| 12 | 12 |
echo "Testing Python 3 functions" |
| 13 | 13 |
|
| 14 | 14 |
# Initialize variables manipulated by functions under test. |
| 15 |
-export ENABLED_PYTHON3_PACKAGES="" |
|
| 16 | 15 |
export DISABLED_PYTHON3_PACKAGES="" |
| 17 | 16 |
|
| 18 |
-assert_false "should not be enabled yet" python3_enabled_for testpackage1 |
|
| 19 |
- |
|
| 20 |
-enable_python3_package testpackage1 |
|
| 21 |
-assert_equal "$ENABLED_PYTHON3_PACKAGES" "testpackage1" "unexpected result" |
|
| 22 |
-assert_true "should be enabled" python3_enabled_for testpackage1 |
|
| 17 |
+assert_true "should be enabled by default" python3_enabled_for testpackage1 |
|
| 23 | 18 |
|
| 24 | 19 |
assert_false "should not be disabled yet" python3_disabled_for testpackage2 |
| 25 | 20 |
|