Add variables ENABLED_PYTHON3_PACKAGES and DISABLED_PYTHON3_PACKAGES to work like ENABLED_SERVICES and DISABLED_SERVICES and to manage which packages are installed using Python 3. Move the list of whitelisted packages in pip_install to the default for ENABLED_PYTHON3_PACKAGES, except swift which is not enabled by default for now. Add enable_python3_package and disable_python3_package functions to make editing the variables from local.conf easier. Add python3_enabled_for and python3_disabled_for functions to check the settings against packages being installed by pip. Update pip_install to check if python3 is disabled for a service, then see if it is explicitly enabled, and only then fall back to looking at the classifiers in the packaging metadata. Update pip_install messages to give more detail about why the choice between python 2 and 3 is being made for a given package. Change-Id: I69857d4e11f4767928614a3b637c894bcd03491f Signed-off-by: Doug Hellmann <doug@doughellmann.com>
		
			
				
	
	
		
			31 lines
		
	
	
		
			874 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			874 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
# Tests for DevStack INI functions
 | 
						|
 | 
						|
TOP=$(cd $(dirname "$0")/.. && pwd)
 | 
						|
 | 
						|
source $TOP/functions-common
 | 
						|
source $TOP/inc/python
 | 
						|
 | 
						|
source $TOP/tests/unittest.sh
 | 
						|
 | 
						|
echo "Testing Python 3 functions"
 | 
						|
 | 
						|
# Initialize variables manipulated by functions under test.
 | 
						|
export ENABLED_PYTHON3_PACKAGES=""
 | 
						|
export DISABLED_PYTHON3_PACKAGES=""
 | 
						|
 | 
						|
assert_false "should not be enabled yet" python3_enabled_for testpackage1
 | 
						|
 | 
						|
enable_python3_package testpackage1
 | 
						|
assert_equal "$ENABLED_PYTHON3_PACKAGES" "testpackage1"  "unexpected result"
 | 
						|
assert_true "should be enabled" python3_enabled_for testpackage1
 | 
						|
 | 
						|
assert_false "should not be disabled yet" python3_disabled_for testpackage2
 | 
						|
 | 
						|
disable_python3_package testpackage2
 | 
						|
assert_equal "$DISABLED_PYTHON3_PACKAGES" "testpackage2"  "unexpected result"
 | 
						|
assert_true "should be disabled" python3_disabled_for testpackage2
 | 
						|
 | 
						|
report_results
 |