summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Paul <info@pierre-paul.com>2012-05-12 18:14:31 -0400
committerPierre Paul <info@pierre-paul.com>2012-05-12 18:14:31 -0400
commit80b0aa42676621a920907bdf7bb1f3f5cc47ac12 (patch)
treec0a19b82dfe84289f1165b41f2375a60449e81be
parent6fe308727334111de435a4ed5f547cc3a1a7f68d (diff)
downloaddisutils2-80b0aa42676621a920907bdf7bb1f3f5cc47ac12.tar.gz
Now creating scripts everytime when build_scripts is called, as a side effect, --force option has been removed
-rw-r--r--CHANGES.txt5
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--distutils2/command/build_scripts.py11
-rw-r--r--distutils2/tests/test_command_build_scripts.py27
4 files changed, 30 insertions, 14 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 698667f..e77005a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,11 @@ their clones, and all changes that have a bug report. Contributors' first names
(and last name initial when needed) are given for each item; see
CONTRIBUTORS.txt for full names. Bug numbers refer to http://bugs.python.org/.
+1.0a5 - 2012-xx-xx
+------------------
+
+- #10374 Now creating scripts everytime when build_scripts is called,
+ as a side effect, --force option has been removed [PierrePaul]
1.0a4 - 2012-03-13
------------------
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index e33eb16..f72c456 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -42,6 +42,7 @@ Thanks to:
- Jeremy Kloth
- Amos Latteier
- Mathieu Leduc-Hamel
+- Pierre Paul Lefebvre
- Tshepang Lekhonkhobe
- Alain Leufroy
- Martin von Löwis
diff --git a/distutils2/command/build_scripts.py b/distutils2/command/build_scripts.py
index 901a679..a274e3a 100644
--- a/distutils2/command/build_scripts.py
+++ b/distutils2/command/build_scripts.py
@@ -20,17 +20,12 @@ class build_scripts(Command, Mixin2to3):
user_options = [
('build-dir=', 'd', "directory to build (copy) to"),
- ('force', 'f', "forcibly build everything (ignore file timestamps"),
('executable=', 'e', "specify final destination interpreter path"),
]
- boolean_options = ['force']
-
-
def initialize_options(self):
self.build_dir = None
self.scripts = None
- self.force = None
self.executable = None
self.outfiles = None
self.use_2to3 = False
@@ -41,7 +36,7 @@ class build_scripts(Command, Mixin2to3):
self.set_undefined_options('build',
('build_scripts', 'build_dir'),
'use_2to3', 'use_2to3_fixers',
- 'convert_2to3_doctests', 'force',
+ 'convert_2to3_doctests',
'executable')
self.scripts = self.distribution.scripts
@@ -69,10 +64,6 @@ class build_scripts(Command, Mixin2to3):
outfile = os.path.join(self.build_dir, os.path.basename(script))
outfiles.append(outfile)
- if not self.force and not newer(script, outfile):
- logger.debug("not copying %s (up-to-date)", script)
- continue
-
# Always open the file, but ignore failures in dry-run mode --
# that way, we'll get accurate feedback if we can read the
# script.
diff --git a/distutils2/tests/test_command_build_scripts.py b/distutils2/tests/test_command_build_scripts.py
index ab41bee..9747153 100644
--- a/distutils2/tests/test_command_build_scripts.py
+++ b/distutils2/tests/test_command_build_scripts.py
@@ -20,7 +20,7 @@ class BuildScriptsTestCase(support.TempdirManager,
cmd.finalize_options()
- self.assertTrue(cmd.force)
+ self.assertFalse(cmd.force)
self.assertEqual(cmd.build_dir, "/foo/bar")
def test_build(self):
@@ -38,13 +38,13 @@ class BuildScriptsTestCase(support.TempdirManager,
for name in expected:
self.assertIn(name, built)
- def get_build_scripts_cmd(self, target, scripts):
+ def get_build_scripts_cmd(self, target, scripts, executable=sys.executable):
dist = Distribution()
dist.scripts = scripts
dist.command_obj["build"] = support.DummyCommand(
build_scripts=target,
- force=True,
- executable=sys.executable,
+ force=False,
+ executable=executable,
use_2to3=False,
use_2to3_fixers=None,
convert_2to3_doctests=None
@@ -105,6 +105,25 @@ class BuildScriptsTestCase(support.TempdirManager,
for name in expected:
self.assertIn(name, built)
+ def test_build_dir_recreated(self):
+ source = self.mkdtemp()
+ target = self.mkdtemp()
+ self.write_script(source, 'taunt', '#! /usr/bin/python')
+
+ built = os.path.join(target, 'taunt')
+
+ cmd = self.get_build_scripts_cmd(target, [os.path.join(source, 'taunt')], 'pythona')
+ cmd.finalize_options()
+ cmd.run()
+
+ self.assertEqual(open(built).readline(), '#!pythona\n')
+
+ cmd = self.get_build_scripts_cmd(target, [os.path.join(source, 'taunt')], 'pythonx')
+ cmd.finalize_options()
+ cmd.run()
+
+ self.assertEqual(open(built).readline(), '#!pythonx\n')
+
def test_suite():
return unittest.makeSuite(BuildScriptsTestCase)