[Python-checkins] r55731 - in python/trunk: Lib/distutils/command/build_py.py Lib/distutils/tests/test_build_py.py Misc/ACKS Misc/NEWS
neal.norwitz
python-checkins at python.org
Fri Jun 1 09:29:13 CEST 2007
Author: neal.norwitz
Date: Fri Jun 1 09:29:12 2007
New Revision: 55731
Modified:
python/trunk/Lib/distutils/command/build_py.py
python/trunk/Lib/distutils/tests/test_build_py.py
python/trunk/Misc/ACKS
python/trunk/Misc/NEWS
Log:
SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
This needs to be backported. I'm too tired tonight. It would be great
if someone backports this if the buildbots are ok with it. Otherwise,
I will try to get to it tomorrow.
Modified: python/trunk/Lib/distutils/command/build_py.py
==============================================================================
--- python/trunk/Lib/distutils/command/build_py.py (original)
+++ python/trunk/Lib/distutils/command/build_py.py Fri Jun 1 09:29:12 2007
@@ -114,7 +114,9 @@
build_dir = os.path.join(*([self.build_lib] + package.split('.')))
# Length of path to strip from found files
- plen = len(src_dir)+1
+ plen = 0
+ if src_dir:
+ plen = len(src_dir)+1
# Strip directory from globbed filenames
filenames = [
Modified: python/trunk/Lib/distutils/tests/test_build_py.py
==============================================================================
--- python/trunk/Lib/distutils/tests/test_build_py.py (original)
+++ python/trunk/Lib/distutils/tests/test_build_py.py Fri Jun 1 09:29:12 2007
@@ -1,10 +1,13 @@
"""Tests for distutils.command.build_py."""
import os
+import sys
+import StringIO
import unittest
from distutils.command.build_py import build_py
from distutils.core import Distribution
+from distutils.errors import DistutilsFileError
from distutils.tests import support
@@ -53,6 +56,38 @@
self.assert_("__init__.pyc" in files)
self.assert_("README.txt" in files)
+ def test_empty_package_dir (self):
+ # See SF 1668596/1720897.
+ cwd = os.getcwd()
+
+ # create the distribution files.
+ sources = self.mkdtemp()
+ open(os.path.join(sources, "__init__.py"), "w").close()
+
+ testdir = os.path.join(sources, "doc")
+ os.mkdir(testdir)
+ open(os.path.join(testdir, "testfile"), "w").close()
+
+ os.chdir(sources)
+ sys.stdout = StringIO.StringIO()
+
+ try:
+ dist = Distribution({"packages": ["pkg"],
+ "package_dir": {"pkg": ""},
+ "package_data": {"pkg": ["doc/*"]}})
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(sources, "setup.py")
+ dist.script_args = ["build"]
+ dist.parse_command_line()
+
+ try:
+ dist.run_commands()
+ except DistutilsFileError:
+ self.fail("failed package_data test when package_dir is ''")
+ finally:
+ # Restore state.
+ os.chdir(cwd)
+ sys.stdout = sys.__stdout__
def test_suite():
return unittest.makeSuite(BuildPyTestCase)
Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS (original)
+++ python/trunk/Misc/ACKS Fri Jun 1 09:29:12 2007
@@ -159,6 +159,7 @@
Vincent Delft
Erik Demaine
Roger Dev
+Raghuram Devarakonda
Toby Dickenson
Mark Dickinson
Yves Dionne
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Jun 1 09:29:12 2007
@@ -220,6 +220,9 @@
Library
-------
+- SF 1668596/1720897: distutils now copies data files
+ even if package_dir is empty.
+
- sha now raises a DeprecationWarning upon import.
- md5 now raises a DeprecationWarning upon import.
More information about the Python-checkins
mailing list