summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorpxinwr <peixing.xin@windriver.com>2020-12-20 22:27:42 (GMT)
committerGitHub <noreply@github.com>2020-12-20 22:27:42 (GMT)
commitab74c014ae514fde7487542ec96ef45235aa86b0 (patch)
tree95f63ef81a87a9d975421287d6d0dbe1b24f4e2e /Lib/distutils
parentc95f8bc2700b42f4568886505a819816c9b0ba28 (diff)
downloadcpython-ab74c014ae514fde7487542ec96ef45235aa86b0.zip
cpython-ab74c014ae514fde7487542ec96ef45235aa86b0.tar.gz
cpython-ab74c014ae514fde7487542ec96ef45235aa86b0.tar.bz2
bpo-31904: Fix site and sysconfig modules for VxWorks RTOS (GH-21821)
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/install.py13
-rw-r--r--Lib/distutils/tests/test_install.py8
2 files changed, 13 insertions, 8 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index aaa300e..bdead13 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -17,7 +17,8 @@ from distutils.errors import DistutilsOptionError
from site import USER_BASE
from site import USER_SITE
-HAS_USER_SITE = True
+
+HAS_USER_SITE = (USER_SITE is not None)
WINDOWS_SCHEME = {
'purelib': '$base/Lib/site-packages',
@@ -169,8 +170,9 @@ class install(Command):
self.install_lib = None # set to either purelib or platlib
self.install_scripts = None
self.install_data = None
- self.install_userbase = USER_BASE
- self.install_usersite = USER_SITE
+ if HAS_USER_SITE:
+ self.install_userbase = USER_BASE
+ self.install_usersite = USER_SITE
self.compile = None
self.optimize = None
@@ -343,8 +345,9 @@ class install(Command):
# Convert directories from Unix /-separated syntax to the local
# convention.
self.convert_paths('lib', 'purelib', 'platlib',
- 'scripts', 'data', 'headers',
- 'userbase', 'usersite')
+ 'scripts', 'data', 'headers')
+ if HAS_USER_SITE:
+ self.convert_paths('userbase', 'usersite')
# Deprecated
# Well, we're not actually fully completely finalized yet: we still
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 51c80e0..21a7b7c 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -8,7 +8,7 @@ import site
from test.support import captured_stdout, run_unittest
from distutils import sysconfig
-from distutils.command.install import install
+from distutils.command.install import install, HAS_USER_SITE
from distutils.command import install as install_module
from distutils.command.build_ext import build_ext
from distutils.command.install import INSTALL_SCHEMES
@@ -66,6 +66,7 @@ class InstallTestCase(support.TempdirManager,
check_path(cmd.install_scripts, os.path.join(destination, "bin"))
check_path(cmd.install_data, destination)
+ @unittest.skipUnless(HAS_USER_SITE, 'need user site')
def test_user_site(self):
# test install with --user
# preparing the environment for the test
@@ -93,8 +94,9 @@ class InstallTestCase(support.TempdirManager,
self.addCleanup(cleanup)
- for key in ('nt_user', 'unix_user'):
- self.assertIn(key, INSTALL_SCHEMES)
+ if HAS_USER_SITE:
+ for key in ('nt_user', 'unix_user'):
+ self.assertIn(key, INSTALL_SCHEMES)
dist = Distribution({'name': 'xx'})
cmd = install(dist)