[Python-checkins] distutils2: Fixed the RECORD initialization. I was using absolute paths rather than paths

tarek.ziade python-checkins at python.org
Mon Apr 5 23:09:19 CEST 2010


tarek.ziade pushed 9f0d6a2724ca to distutils2:

http://hg.python.org/distutils2/rev/9f0d6a2724ca
changeset:   105:9f0d6a2724ca
user:        pumazi
date:        Thu Apr 01 16:46:12 2010 -0400
summary:     Fixed the RECORD initialization. I was using absolute paths rather than paths relative to sys.prefix.
files:       src/distutils2/_backport/tests/test_pkgutil.py

diff --git a/src/distutils2/_backport/tests/test_pkgutil.py b/src/distutils2/_backport/tests/test_pkgutil.py
--- a/src/distutils2/_backport/tests/test_pkgutil.py
+++ b/src/distutils2/_backport/tests/test_pkgutil.py
@@ -31,9 +31,10 @@
             md5_hash.update(open(file).read())
             return md5_hash.hexdigest()
         def record_pieces(file):
+            path = os.path.relpath(file, sys.prefix)
             digest = get_hexdigest(file)
             size = os.path.getsize(file)
-            return [file, digest, size]
+            return [path, digest, size]
 
         self.records = {}
         for distinfo_dir in self.distinfo_dirs:
@@ -103,10 +104,10 @@
         distinfo_dir = os.path.join(self.fake_dists_path,
             distinfo_name + '.dist-info')
         true_path = [self.fake_dists_path, distinfo_name, 'grammar', 'utils.py']
-        true_path = os.path.join(*true_path)
+        true_path = os.path.relpath(os.path.join(*true_path), sys.prefix)
         false_path = [self.fake_dists_path, 'towel_stuff-0.1', 'towel_stuff',
             '__init__.py']
-        false_path = os.path.join(*false_path)
+        false_path = os.path.relpath(os.path.join(*false_path), sys.prefix)
 
         # Test if the distribution uses the file in question
         from distutils2._backport.pkgutil import Distribution

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list