Julien Jehannet avatar Julien Jehannet committed 5f35aee

rename patches

Comments (0)

Files changed (4)

feature-extra_files_under_project.diff

+# HG changeset patch
+# Parent d02ea09f24fa66fb2af14b5eae86aebfaae94dd9
+# User Julien Jehannet <julien@smaf.org>
+# Date 1296409793 -3600
+Avoid double-declaration in double-declaration in description- and extra- files
+
+Since changeset c8dfb3c63894, files in metadata must be declared in `extra_files`.
+In order to simplify the declaration, include automatically these files when
+under project directory.
+
+The detection is really done by these two conditions:
+- is not an absolute path
+- not in one of parent directory
+
+Note: the heuristic is quite fragile here.
+
+diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
+--- a/distutils2/command/sdist.py
++++ b/distutils2/command/sdist.py
+@@ -193,6 +193,19 @@ class sdist(Command):
+         reading the manifest, or just using the default file set -- it all
+         depends on the user's options.
+         """
++        # Remark: external path files are allowed in setup.cfg
++        # This implies declarations in `extra_files` to include them in the
++        # source distribution but we want make them implicit when files are
++        # already under the project path (i.e. not absolute paths or not in
++        # parent directory)
++        for file in self.distribution.metadata.requires_files:
++            # XXX fragile heuristic: file cannot starts with '..'
++            if (not os.path.isabs(file) and
++                not os.path.normpath(file).startswith('..')):
++                 self.distribution.metadata.requires_files.remove(file)
++                 self.distribution.extra_files.append(file)
++                 self.filelist.append(file)
++
+         template_exists = len(self.distribution.extra_files) > 0
+         if not template_exists:
+             self.warn('Using default file list')
+@@ -200,6 +213,7 @@ class sdist(Command):
+ 
+         if self.use_defaults:
+             self.add_defaults()
++
+         if template_exists:
+             template = '\n'.join(self.distribution.extra_files)
+             self.filelist.read_template(StringIO(template))
+diff --git a/distutils2/tests/test_config.py b/distutils2/tests/test_config.py
+--- a/distutils2/tests/test_config.py
++++ b/distutils2/tests/test_config.py
+@@ -3,6 +3,7 @@
+ import os
+ import sys
+ from StringIO import StringIO
++import tempfile
+ 
+ from distutils2.tests import unittest, support, run_unittest
+ from distutils2.command.sdist import sdist
+@@ -302,6 +303,29 @@ class ConfigTestCase(support.TempdirMana
+         self.assertEqual(ext.extra_compile_args, ['-fPIC', '-O2'])
+         self.assertEqual(ext.language, 'cxx')
+ 
++    def test_metadata_requires_external_description_files(self):
++        tmpdir = tempfile.mkdtemp()
++        readme = os.path.join(tmpdir, 'README')
++        self.write_setup({'description-file': readme + '\n'})
++        self.write_file(readme, 'yeah')
++        self.write_file('haven.py', '#')
++        self.write_file('script1.py', '#')
++        os.mkdir('scripts')
++        self.write_file(os.path.join('scripts', 'find-coconuts'), '#')
++        os.mkdir('bin')
++        self.write_file(os.path.join('bin', 'taunt'), '#')
++
++        os.mkdir('src')
++        for pkg in ('one', 'two', 'three'):
++            pkg = os.path.join('src', pkg)
++            os.mkdir(pkg)
++            self.write_file(os.path.join(pkg, '__init__.py'), '#')
++
++        dist = self.run_setup('--version')
++        cmd = sdist(dist)
++        cmd.finalize_options()
++        cmd.get_file_list()
++        self.assertRaises(DistutilsFileError, cmd.make_distribution)
+ 
+     def test_metadata_requires_description_files_missing(self):
+         self.write_setup({'description-file': 'README\n  README2'})
+@@ -350,8 +374,10 @@ class ConfigTestCase(support.TempdirMana
+         cmd = sdist(dist)
+         cmd.finalize_options()
+         cmd.get_file_list()
+-        self.assertRaises(DistutilsFileError, cmd.make_distribution)
++        cmd.make_distribution()
++        self.assertIn('README\nREADME2\n', open('MANIFEST').read())
+ 
++        # test if double-declaration in description- and extra- files
+         self.write_setup({'description-file': 'README\n  README2',
+                           'extra-files': '\n  README2\n    README'})
+         dist = self.run_setup('--description')

feature-sdist-make_directory.diff

+# HG changeset patch
+# User Julien Jehannet <julien@smaf.org>
+# Date 1296380094 -3600
+# Node ID 309f6914f393c9109277f1e3189667dcf333096a
+# Parent  7dc4323bb9652aab1667431eb62e25c4236b57a6
+Add new format `files` in source distribution command (sdist). Used in debugging.
+
+diff --git a/distutils2/_backport/shutil.py b/distutils2/_backport/shutil.py
+--- a/distutils2/_backport/shutil.py
++++ b/distutils2/_backport/shutil.py
+@@ -328,6 +328,18 @@ def _get_uid(name):
+         return result[2]
+     return None
+ 
++def _make_directory(archive_dir, base_dir, verbose=0, dry_run=0, owner=None,
++                    group=None, logger=None):
++    """Create a directory full of files coming from 'base_dir'.
++
++    The output directory name will be named 'base_dir'
++
++    Returns the output directory.
++    """
++    if not dry_run:
++        copytree(base_dir, archive_dir)
++    return archive_dir
++
+ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
+                   owner=None, group=None, logger=None):
+     """Create a (possibly compressed) tar file from all the files under
+@@ -473,6 +485,7 @@ def _make_zipfile(base_name, base_dir, v
+     return zip_filename
+ 
+ _ARCHIVE_FORMATS = {
++    'files': (_make_directory, [], "a directory full of files"),
+     'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
+     'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
+     'ztar':  (_make_tarball, [('compress', 'compress')],

fix-file-under-projet.diff

-# HG changeset patch
-# Parent d02ea09f24fa66fb2af14b5eae86aebfaae94dd9
-# User Julien Jehannet <julien@smaf.org>
-# Date 1296409793 -3600
-Avoid double-declaration in double-declaration in description- and extra- files
-
-Since changeset c8dfb3c63894, files in metadata must be declared in `extra_files`.
-In order to simplify the declaration, include automatically these files when
-under project directory.
-
-The detection is really done by these two conditions:
-- is not an absolute path
-- not in one of parent directory
-
-Note: the heuristic is quite fragile here.
-
-diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
---- a/distutils2/command/sdist.py
-+++ b/distutils2/command/sdist.py
-@@ -193,6 +193,19 @@ class sdist(Command):
-         reading the manifest, or just using the default file set -- it all
-         depends on the user's options.
-         """
-+        # Remark: external path files are allowed in setup.cfg
-+        # This implies declarations in `extra_files` to include them in the
-+        # source distribution but we want make them implicit when files are
-+        # already under the project path (i.e. not absolute paths or not in
-+        # parent directory)
-+        for file in self.distribution.metadata.requires_files:
-+            # XXX fragile heuristic: file cannot starts with '..'
-+            if (not os.path.isabs(file) and
-+                not os.path.normpath(file).startswith('..')):
-+                 self.distribution.metadata.requires_files.remove(file)
-+                 self.distribution.extra_files.append(file)
-+                 self.filelist.append(file)
-+
-         template_exists = len(self.distribution.extra_files) > 0
-         if not template_exists:
-             self.warn('Using default file list')
-@@ -200,6 +213,7 @@ class sdist(Command):
- 
-         if self.use_defaults:
-             self.add_defaults()
-+
-         if template_exists:
-             template = '\n'.join(self.distribution.extra_files)
-             self.filelist.read_template(StringIO(template))
-diff --git a/distutils2/tests/test_config.py b/distutils2/tests/test_config.py
---- a/distutils2/tests/test_config.py
-+++ b/distutils2/tests/test_config.py
-@@ -3,6 +3,7 @@
- import os
- import sys
- from StringIO import StringIO
-+import tempfile
- 
- from distutils2.tests import unittest, support, run_unittest
- from distutils2.command.sdist import sdist
-@@ -302,6 +303,29 @@ class ConfigTestCase(support.TempdirMana
-         self.assertEqual(ext.extra_compile_args, ['-fPIC', '-O2'])
-         self.assertEqual(ext.language, 'cxx')
- 
-+    def test_metadata_requires_external_description_files(self):
-+        tmpdir = tempfile.mkdtemp()
-+        readme = os.path.join(tmpdir, 'README')
-+        self.write_setup({'description-file': readme + '\n'})
-+        self.write_file(readme, 'yeah')
-+        self.write_file('haven.py', '#')
-+        self.write_file('script1.py', '#')
-+        os.mkdir('scripts')
-+        self.write_file(os.path.join('scripts', 'find-coconuts'), '#')
-+        os.mkdir('bin')
-+        self.write_file(os.path.join('bin', 'taunt'), '#')
-+
-+        os.mkdir('src')
-+        for pkg in ('one', 'two', 'three'):
-+            pkg = os.path.join('src', pkg)
-+            os.mkdir(pkg)
-+            self.write_file(os.path.join(pkg, '__init__.py'), '#')
-+
-+        dist = self.run_setup('--version')
-+        cmd = sdist(dist)
-+        cmd.finalize_options()
-+        cmd.get_file_list()
-+        self.assertRaises(DistutilsFileError, cmd.make_distribution)
- 
-     def test_metadata_requires_description_files_missing(self):
-         self.write_setup({'description-file': 'README\n  README2'})
-@@ -350,8 +374,10 @@ class ConfigTestCase(support.TempdirMana
-         cmd = sdist(dist)
-         cmd.finalize_options()
-         cmd.get_file_list()
--        self.assertRaises(DistutilsFileError, cmd.make_distribution)
-+        cmd.make_distribution()
-+        self.assertIn('README\nREADME2\n', open('MANIFEST').read())
- 
-+        # test if double-declaration in description- and extra- files
-         self.write_setup({'description-file': 'README\n  README2',
-                           'extra-files': '\n  README2\n    README'})
-         dist = self.run_setup('--description')
-fix-file-under-projet.diff
+feature-sdist-make_directory.diff
+feature-extra_files_under_project.diff
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.