[Python-checkins] r59996 - in sandbox/trunk/pep370/Lib: distutils/command/install.py test/test_site.py
christian.heimes
python-checkins at python.org
Wed Jan 16 11:18:13 CET 2008
Author: christian.heimes
Date: Wed Jan 16 11:18:12 2008
New Revision: 59996
Modified:
sandbox/trunk/pep370/Lib/distutils/command/install.py
sandbox/trunk/pep370/Lib/test/test_site.py
Log:
Finished the integration test for the -s option
Added some checks to distutils.commands.install
Modified: sandbox/trunk/pep370/Lib/distutils/command/install.py
==============================================================================
--- sandbox/trunk/pep370/Lib/distutils/command/install.py (original)
+++ sandbox/trunk/pep370/Lib/distutils/command/install.py Wed Jan 16 11:18:12 2008
@@ -425,6 +425,9 @@
return
if self.user:
+ if self.install_userbase is None:
+ raise DistutilsPlatformError(
+ "User base directory is not specified")
self.install_base = self.install_platbase = self.install_userbase
self.select_scheme("unix_user")
elif self.home is not None:
@@ -453,6 +456,9 @@
def finalize_other (self): # Windows and Mac OS for now
if self.user:
+ if self.install_userbase is None:
+ raise DistutilsPlatformError(
+ "User base directory is not specified")
self.install_base = self.install_platbase = self.install_userbase
self.select_scheme(os.name + "_user")
elif self.home is not None:
Modified: sandbox/trunk/pep370/Lib/test/test_site.py
==============================================================================
--- sandbox/trunk/pep370/Lib/test/test_site.py (original)
+++ sandbox/trunk/pep370/Lib/test/test_site.py Wed Jan 16 11:18:12 2008
@@ -95,11 +95,21 @@
def test_s_option(self):
usersite = site.USER_SITE
self.assert_(usersite in sys.path)
- cmd = [sys.executable, "-c",
- "\"import sys; sys.exit('%s' in sys.path)\"" % usersite
- ]
- p = subprocess.Popen(cmd)
- self.assertEqual(p.wait(), 0)
+
+ rc = subprocess.call([sys.executable, '-c',
+ 'import sys; sys.exit("%s" in sys.path)' % usersite])
+ self.assertEqual(rc, 1)
+
+ rc = subprocess.call([sys.executable, '-s', '-c',
+ 'import sys; sys.exit("%s" in sys.path)' % usersite])
+ self.assertEqual(rc, 0)
+
+ env = os.environ.copy()
+ env["PYTHONNOUSERSITE"] = "1"
+ rc = subprocess.call([sys.executable, '-c',
+ 'import sys; sys.exit("%s" in sys.path)' % usersite],
+ env=env)
+ self.assertEqual(rc, 0)
class PthFile(object):
More information about the Python-checkins
mailing list