Commits

Anonymous committed 7df3a7a Merge

merged with tarek's code

Comments (0)

Files changed (13)

src/CONTRIBUTORS.txt

+============
+Contributors
+============
+
+Distutils2 is a project that was started and that is maintained by
+Tarek Ziadé, and many people are contributing to the project.
+
+If you did, please add your name below in alphabetical order !
+
+Thanks to:
+
+- Pior Bastida
+- Titus Brown
+- Nicolas Cadou
+- Yannick Gringas
+- Carl Meyer
+- Michael Mulich
+- George Peris
+- Sean Reifschneider
+- Erik Rose
+- Brian Rosner
+- Alexandre Vassalotti
+- Martin von Löwis
+
+Notes for developers
+====================
+
+- Distutils2 runs from 2.4 to 3.2 (3.x not implemented yet), so
+  make sure you don't use a syntax that doesn't work under
+  a specific Python version.
+
+- Always run tests.sh before you push a change. This implies
+  that you have all Python versions installed.
+

src/distutils2/command/sdist.py

         self.metadata_check = 1
         self.owner = None
         self.group = None
+        self.filelist = None
 
     def _check_archive_formats(self, formats):
         supported_formats = [name for name, desc in get_archive_formats()]
         if self.dist_dir is None:
             self.dist_dir = "dist"
 
+        if self.filelist is None:
+            self.filelist = Manifest()
+
+
     def run(self):
         # 'filelist' contains the list of files that will make up the
         # manifest
-        self.filelist = Manifest()
+        self.filelist.clear()
 
         # Run sub commands
         for cmd_name in self.get_sub_commands():
         if self.use_defaults:
             self.add_defaults()
         if template_exists:
-            self.read_template()
+            self.filelist.read_template(self.template)
         if self.prune:
             self.prune_file_list()
 

src/distutils2/converter/fixers/fix_imports.py

         if node.type != syms.import_from:
             return
 
+        if not hasattr(imp, "next_sibling"):
+            imp.next_sibling = imp.get_next_sibling()
+
         while not hasattr(imp, 'value'):
             imp = imp.children[0]
 
             next = imp.next_sibling
             while next is not None:
                 pattern.append(next.value)
+                if not hasattr(next, "next_sibling"):
+                    next.next_sibling = next.get_next_sibling()
                 next = next.next_sibling
             if pattern == ['import', 'setup']:
                 imp.value = 'distutils2.core'

src/distutils2/converter/fixers/fix_setup_options.py

 
     def _fix_name(self, argument, remove_list):
         name = argument.children[0]
+
+        if not hasattr(name, "next_sibling"):
+            name.next_sibling = name.get_next_sibling()
+
         sibling = name.next_sibling
         if sibling is None or sibling.type != token.EQUAL:
             return False
         if name.value in _OLD_NAMES:
             name.value = _OLD_NAMES[name.value]
             if name.value in _SEQUENCE_NAMES:
+                if not hasattr(sibling, "next_sibling"):
+                    sibling.next_sibling = sibling.get_next_sibling()
                 right_operand = sibling.next_sibling
                 # replacing string -> list[string]
                 if right_operand.type == token.STRING:

src/distutils2/dist.py

File contents unchanged.

src/distutils2/manifest.py

         for sort_tuple in sortable_files:
             self.files.append(os.path.join(*sort_tuple))
 
+    def clear(self):
+        """Clear all collected files."""
+        self.files = []
+        if self.allfiles is not None:
+            self.allfiles = []
+
     def remove_duplicates(self):
         # Assumes list has been sorted!
         for i in range(len(self.files) - 1, 0, -1):

src/distutils2/tests/test_converter.py

     return unittest2.makeSuite(ConverterTestCase)
 
 if __name__ == '__main__':
-    run_unittest(test_suite())
+    unittest2.main(defaultTest="test_suite")

src/distutils2/tests/test_core.py

         distutils2.core.run_setup(
             self.write_setup(setup_using___file__))
 
+    def test_run_setup_stop_after(self):
+        f = self.write_setup(setup_using___file__)
+        for s in ['init', 'config', 'commandline', 'run']:
+            distutils2.core.run_setup(f, stop_after=s)
+        self.assertRaises(ValueError, distutils2.core.run_setup, 
+                          f, stop_after='bob')
+
+    def test_run_setup_args(self):
+        f = self.write_setup(setup_using___file__)
+        d = distutils2.core.run_setup(f, script_args=["--help"], 
+                                        stop_after="init")
+        self.assertEqual(['--help'], d.script_args)
+
     def test_run_setup_uses_current_dir(self):
         # This tests that the setup script is run with the current directory
         # as its own current directory; this was temporarily broken by a

src/distutils2/tests/test_sdist.py

         finally:
             archive.close()
 
+    def test_get_file_list(self):
+        dist, cmd = self.get_cmd()
+        cmd.finalize_options()
+        cmd.template = os.path.join(self.tmp_dir, 'MANIFEST.in')
+        f = open(cmd.template, 'w')
+        try:
+            f.write('include MANIFEST.in\n')
+        finally:
+            f.close()
+
+        cmd.get_file_list()
+        self.assertIn('MANIFEST.in', cmd.filelist.files)
+
 def test_suite():
     return unittest2.makeSuite(SDistTestCase)
 

src/distutils2/tests/test_version.py

File contents unchanged.
 
 def test_main():
     import distutils2.tests
-    from distutils2.tests import run_unittest, reap_children
+    from distutils2.tests import run_unittest, reap_children, TestFailed
     from distutils2._backport.tests import test_suite as btest_suite
     # just supporting -q right now
     # to enable detailed/quiet output
         verbose = sys.argv[-1] != '-q'
     else:
         verbose = 1
-
-    run_unittest([distutils2.tests.test_suite(), btest_suite()],
-                 verbose_=verbose)
-    reap_children()
+    try:
+        try:
+            run_unittest([distutils2.tests.test_suite(), btest_suite()],
+                    verbose_=verbose)
+            return 0
+        except TestFailed:
+            return 1
+    finally:
+        reap_children()
 
 if __name__ == "__main__":
     try:
         print('!!! You need to install unittest2')
         sys.exit(1)
 
-    test_main()
+    sys.exit(test_main())
+
 #!/bin/sh
-echo Testing with Python 2.4....
-python2.4 runtests.py -q
+echo -n "Running tests for Python 2.4..."
+python2.4 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi
 
-echo
-echo Testing with Python 2.5....
-python2.5 runtests.py -q
+echo -n "Running tests for Python 2.5..."
+python2.5 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi
 
-echo
-echo Testing with Python 2.6....
-python2.6 runtests.py -q
+echo -n "Running tests for Python 2.6..."
+python2.6 runtests.py -q > /dev/null 2> /dev/null
+if [ $? -ne 0 ];then
+    echo "Failed"
+    exit $1
+else
+    echo "Success"
+fi