[Python-checkins] distutils2: merge latest
tarek.ziade
python-checkins at python.org
Sun Jan 30 10:43:58 CET 2011
tarek.ziade pushed cf4e49ee4904 to distutils2:
http://hg.python.org/distutils2/rev/cf4e49ee4904
changeset: 945:cf4e49ee4904
parent: 944:c7deaaa88de8
parent: 920:860a4bcab873
user: Gael Pasgrimaud <gael at gawel.org>
date: Sat Jan 29 16:27:49 2011 +0100
summary:
merge latest
files:
patch
diff --git a/distutils2/_backport/pkgutil.py b/distutils2/_backport/pkgutil.py
--- a/distutils2/_backport/pkgutil.py
+++ b/distutils2/_backport/pkgutil.py
@@ -660,14 +660,14 @@
_cache_generated_egg = False
-def _yield_distributions(include_dist, include_egg):
+def _yield_distributions(include_dist, include_egg, paths=sys.path):
"""
Yield .dist-info and .egg(-info) distributions, based on the arguments
:parameter include_dist: yield .dist-info distributions
:parameter include_egg: yield .egg(-info) distributions
"""
- for path in sys.path:
+ for path in paths:
realpath = os.path.realpath(path)
if not os.path.isdir(realpath):
continue
@@ -679,7 +679,7 @@
dir.endswith('.egg')):
yield EggInfoDistribution(dist_path)
-def _generate_cache(use_egg_info=False):
+def _generate_cache(use_egg_info=False, paths=sys.path):
global _cache_generated, _cache_generated_egg
if _cache_generated_egg or (_cache_generated and not use_egg_info):
@@ -688,7 +688,7 @@
gen_dist = not _cache_generated
gen_egg = use_egg_info
- for dist in _yield_distributions(gen_dist, gen_egg):
+ for dist in _yield_distributions(gen_dist, gen_egg, paths):
if isinstance(dist, Distribution):
_cache_path[dist.path] = dist
if not dist.name in _cache_name:
@@ -1017,7 +1017,7 @@
return '-'.join([name, normalized_version]) + file_extension
-def get_distributions(use_egg_info=False):
+def get_distributions(use_egg_info=False, paths=sys.path):
"""
Provides an iterator that looks for ``.dist-info`` directories in
``sys.path`` and returns :class:`Distribution` instances for each one of
@@ -1028,7 +1028,7 @@
instances
"""
if not _cache_enabled:
- for dist in _yield_distributions(True, use_egg_info):
+ for dist in _yield_distributions(True, use_egg_info, paths):
yield dist
else:
_generate_cache(use_egg_info)
@@ -1041,7 +1041,7 @@
yield dist
-def get_distribution(name, use_egg_info=False):
+def get_distribution(name, use_egg_info=False, paths=sys.path):
"""
Scans all elements in ``sys.path`` and looks for all directories
ending with ``.dist-info``. Returns a :class:`Distribution`
@@ -1059,7 +1059,7 @@
:rtype: :class:`Distribution` or :class:`EggInfoDistribution` or None
"""
if not _cache_enabled:
- for dist in _yield_distributions(True, use_egg_info):
+ for dist in _yield_distributions(True, use_egg_info, paths):
if dist.name == name:
return dist
else:
diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
--- a/distutils2/command/sdist.py
+++ b/distutils2/command/sdist.py
@@ -215,8 +215,6 @@
def add_defaults(self):
"""Add all the default files to self.filelist:
- - README or README.txt
- - test/test*.py
- all pure Python modules mentioned in setup script
- all files pointed by package_data (build_py)
- all files defined in data_files.
@@ -226,32 +224,6 @@
Warns if (README or README.txt) or setup.py are missing; everything
else is optional.
"""
- standards = [('README', 'README.txt')]
- for fn in standards:
- if isinstance(fn, tuple):
- alts = fn
- got_it = 0
- for fn in alts:
- if os.path.exists(fn):
- got_it = 1
- self.filelist.append(fn)
- break
-
- if not got_it:
- self.warn("standard file not found: should have one of " +
- string.join(alts, ', '))
- else:
- if os.path.exists(fn):
- self.filelist.append(fn)
- else:
- self.warn("standard file '%s' not found" % fn)
-
- optional = ['test/test*.py', 'setup.cfg']
- for pattern in optional:
- files = filter(os.path.isfile, glob(pattern))
- if files:
- self.filelist.extend(files)
-
for cmd_name in get_command_names():
try:
cmd_obj = self.get_finalized_command(cmd_name)
@@ -323,7 +295,7 @@
for file in self.distribution.metadata.requires_files:
if file not in files:
- msg = "'%s' must be included explicitly extra-files metadata" % file
+ msg = "'%s' must be included explicitly in 'extra_files'" % file
raise DistutilsFileError(msg)
for file in files:
@@ -383,4 +355,3 @@
# Now create them
for dir in need_dirs:
self.mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
-
diff --git a/distutils2/markers.py b/distutils2/markers.py
new file mode 100644
--- /dev/null
+++ b/distutils2/markers.py
@@ -0,0 +1,194 @@
+""" Micro-language for PEP 345 environment markers
+"""
+import sys
+import platform
+import os
+from tokenize import tokenize, NAME, OP, STRING, ENDMARKER
+from StringIO import StringIO
+
+__all__ = ['interpret']
+
+
+# allowed operators
+_OPERATORS = {'==': lambda x, y: x == y,
+ '!=': lambda x, y: x != y,
+ '>': lambda x, y: x > y,
+ '>=': lambda x, y: x >= y,
+ '<': lambda x, y: x < y,
+ '<=': lambda x, y: x <= y,
+ 'in': lambda x, y: x in y,
+ 'not in': lambda x, y: x not in y}
+
+
+def _operate(operation, x, y):
+ return _OPERATORS[operation](x, y)
+
+
+# restricted set of variables
+_VARS = {'sys.platform': sys.platform,
+ 'python_version': sys.version[:3],
+ 'python_full_version': sys.version.split(' ', 1)[0],
+ 'os.name': os.name,
+ 'platform.version': platform.version(),
+ 'platform.machine': platform.machine()}
+
+
+class _Operation(object):
+
+ def __init__(self, execution_context=None):
+ self.left = None
+ self.op = None
+ self.right = None
+ if execution_context is None:
+ execution_context = {}
+ self.execution_context = execution_context
+
+ def _get_var(self, name):
+ if name in self.execution_context:
+ return self.execution_context[name]
+ return _VARS[name]
+
+ def __repr__(self):
+ return '%s %s %s' % (self.left, self.op, self.right)
+
+ def _is_string(self, value):
+ if value is None or len(value) < 2:
+ return False
+ for delimiter in '"\'':
+ if value[0] == value[-1] == delimiter:
+ return True
+ return False
+
+ def _is_name(self, value):
+ return value in _VARS
+
+ def _convert(self, value):
+ if value in _VARS:
+ return self._get_var(value)
+ return value.strip('"\'')
+
+ def _check_name(self, value):
+ if value not in _VARS:
+ raise NameError(value)
+
+ def _nonsense_op(self):
+ msg = 'This operation is not supported : "%s"' % self
+ raise SyntaxError(msg)
+
+ def __call__(self):
+ # make sure we do something useful
+ if self._is_string(self.left):
+ if self._is_string(self.right):
+ self._nonsense_op()
+ self._check_name(self.right)
+ else:
+ if not self._is_string(self.right):
+ self._nonsense_op()
+ self._check_name(self.left)
+
+ if self.op not in _OPERATORS:
+ raise TypeError('Operator not supported "%s"' % self.op)
+
+ left = self._convert(self.left)
+ right = self._convert(self.right)
+ return _operate(self.op, left, right)
+
+
+class _OR(object):
+ def __init__(self, left, right=None):
+ self.left = left
+ self.right = right
+
+ def filled(self):
+ return self.right is not None
+
+ def __repr__(self):
+ return 'OR(%r, %r)' % (self.left, self.right)
+
+ def __call__(self):
+ return self.left() or self.right()
+
+
+class _AND(object):
+ def __init__(self, left, right=None):
+ self.left = left
+ self.right = right
+
+ def filled(self):
+ return self.right is not None
+
+ def __repr__(self):
+ return 'AND(%r, %r)' % (self.left, self.right)
+
+ def __call__(self):
+ return self.left() and self.right()
+
+
+class _CHAIN(object):
+
+ def __init__(self, execution_context=None):
+ self.ops = []
+ self.op_starting = True
+ self.execution_context = execution_context
+
+ def eat(self, toktype, tokval, rowcol, line, logical_line):
+ if toktype not in (NAME, OP, STRING, ENDMARKER):
+ raise SyntaxError('Type not supported "%s"' % tokval)
+
+ if self.op_starting:
+ op = _Operation(self.execution_context)
+ if len(self.ops) > 0:
+ last = self.ops[-1]
+ if isinstance(last, (_OR, _AND)) and not last.filled():
+ last.right = op
+ else:
+ self.ops.append(op)
+ else:
+ self.ops.append(op)
+ self.op_starting = False
+ else:
+ op = self.ops[-1]
+
+ if (toktype == ENDMARKER or
+ (toktype == NAME and tokval in ('and', 'or'))):
+ if toktype == NAME and tokval == 'and':
+ self.ops.append(_AND(self.ops.pop()))
+ elif toktype == NAME and tokval == 'or':
+ self.ops.append(_OR(self.ops.pop()))
+ self.op_starting = True
+ return
+
+ if isinstance(op, (_OR, _AND)) and op.right is not None:
+ op = op.right
+
+ if ((toktype in (NAME, STRING) and tokval not in ('in', 'not'))
+ or (toktype == OP and tokval == '.')):
+ if op.op is None:
+ if op.left is None:
+ op.left = tokval
+ else:
+ op.left += tokval
+ else:
+ if op.right is None:
+ op.right = tokval
+ else:
+ op.right += tokval
+ elif toktype == OP or tokval in ('in', 'not'):
+ if tokval == 'in' and op.op == 'not':
+ op.op = 'not in'
+ else:
+ op.op = tokval
+
+ def result(self):
+ for op in self.ops:
+ if not op():
+ return False
+ return True
+
+
+def interpret(marker, execution_context=None):
+ """Interpret a marker and return a result depending on environment."""
+ marker = marker.strip()
+ operations = _CHAIN(execution_context)
+ tokenize(StringIO(marker).readline, operations.eat)
+ return operations.result()
diff --git a/distutils2/metadata.py b/distutils2/metadata.py
--- a/distutils2/metadata.py
+++ b/distutils2/metadata.py
@@ -5,13 +5,12 @@
import os
import sys
-import platform
import re
from StringIO import StringIO
from email import message_from_file
-from tokenize import tokenize, NAME, OP, STRING, ENDMARKER
from distutils2 import logger
+from distutils2.markers import interpret
from distutils2.version import (is_valid_predicate, is_valid_version,
is_valid_versions)
from distutils2.errors import (MetadataMissingError,
@@ -291,7 +290,7 @@
if not self.platform_dependent or ';' not in value:
return True, value
value, marker = value.split(';')
- return _interpret(marker, self.execution_context), value
+ return interpret(marker, self.execution_context), value
def _remove_line_prefix(self, value):
return _LINE_PREFIX.sub('\n', value)
@@ -518,191 +517,3 @@
def items(self):
"""Dict like api"""
return [(key, self[key]) for key in self.keys()]
-
-
-#
-# micro-language for PEP 345 environment markers
-#
-
-# allowed operators
-_OPERATORS = {'==': lambda x, y: x == y,
- '!=': lambda x, y: x != y,
- '>': lambda x, y: x > y,
- '>=': lambda x, y: x >= y,
- '<': lambda x, y: x < y,
- '<=': lambda x, y: x <= y,
- 'in': lambda x, y: x in y,
- 'not in': lambda x, y: x not in y}
-
-
-def _operate(operation, x, y):
- return _OPERATORS[operation](x, y)
-
-# restricted set of variables
-_VARS = {'sys.platform': sys.platform,
- 'python_version': sys.version[:3],
- 'python_full_version': sys.version.split(' ', 1)[0],
- 'os.name': os.name,
- 'platform.version': platform.version(),
- 'platform.machine': platform.machine()}
-
-
-class _Operation(object):
-
- def __init__(self, execution_context=None):
- self.left = None
- self.op = None
- self.right = None
- if execution_context is None:
- execution_context = {}
- self.execution_context = execution_context
-
- def _get_var(self, name):
- if name in self.execution_context:
- return self.execution_context[name]
- return _VARS[name]
-
- def __repr__(self):
- return '%s %s %s' % (self.left, self.op, self.right)
-
- def _is_string(self, value):
- if value is None or len(value) < 2:
- return False
- for delimiter in '"\'':
- if value[0] == value[-1] == delimiter:
- return True
- return False
-
- def _is_name(self, value):
- return value in _VARS
-
- def _convert(self, value):
- if value in _VARS:
- return self._get_var(value)
- return value.strip('"\'')
-
- def _check_name(self, value):
- if value not in _VARS:
- raise NameError(value)
-
- def _nonsense_op(self):
- msg = 'This operation is not supported : "%s"' % self
- raise SyntaxError(msg)
-
- def __call__(self):
- # make sure we do something useful
- if self._is_string(self.left):
- if self._is_string(self.right):
- self._nonsense_op()
- self._check_name(self.right)
- else:
- if not self._is_string(self.right):
- self._nonsense_op()
- self._check_name(self.left)
-
- if self.op not in _OPERATORS:
- raise TypeError('Operator not supported "%s"' % self.op)
-
- left = self._convert(self.left)
- right = self._convert(self.right)
- return _operate(self.op, left, right)
-
-
-class _OR(object):
- def __init__(self, left, right=None):
- self.left = left
- self.right = right
-
- def filled(self):
- return self.right is not None
-
- def __repr__(self):
- return 'OR(%r, %r)' % (self.left, self.right)
-
- def __call__(self):
- return self.left() or self.right()
-
-
-class _AND(object):
- def __init__(self, left, right=None):
- self.left = left
- self.right = right
-
- def filled(self):
- return self.right is not None
-
- def __repr__(self):
- return 'AND(%r, %r)' % (self.left, self.right)
-
- def __call__(self):
- return self.left() and self.right()
-
-
-class _CHAIN(object):
-
- def __init__(self, execution_context=None):
- self.ops = []
- self.op_starting = True
- self.execution_context = execution_context
-
- def eat(self, toktype, tokval, rowcol, line, logical_line):
- if toktype not in (NAME, OP, STRING, ENDMARKER):
- raise SyntaxError('Type not supported "%s"' % tokval)
-
- if self.op_starting:
- op = _Operation(self.execution_context)
- if len(self.ops) > 0:
- last = self.ops[-1]
- if isinstance(last, (_OR, _AND)) and not last.filled():
- last.right = op
- else:
- self.ops.append(op)
- else:
- self.ops.append(op)
- self.op_starting = False
- else:
- op = self.ops[-1]
-
- if (toktype == ENDMARKER or
- (toktype == NAME and tokval in ('and', 'or'))):
- if toktype == NAME and tokval == 'and':
- self.ops.append(_AND(self.ops.pop()))
- elif toktype == NAME and tokval == 'or':
- self.ops.append(_OR(self.ops.pop()))
- self.op_starting = True
- return
-
- if isinstance(op, (_OR, _AND)) and op.right is not None:
- op = op.right
-
- if ((toktype in (NAME, STRING) and tokval not in ('in', 'not'))
- or (toktype == OP and tokval == '.')):
- if op.op is None:
- if op.left is None:
- op.left = tokval
- else:
- op.left += tokval
- else:
- if op.right is None:
- op.right = tokval
- else:
- op.right += tokval
- elif toktype == OP or tokval in ('in', 'not'):
- if tokval == 'in' and op.op == 'not':
- op.op = 'not in'
- else:
- op.op = tokval
-
- def result(self):
- for op in self.ops:
- if not op():
- return False
- return True
-
-
-def _interpret(marker, execution_context=None):
- """Interpret a marker and return a result depending on environment."""
- marker = marker.strip()
- operations = _CHAIN(execution_context)
- tokenize(StringIO(marker).readline, operations.eat)
- return operations.result()
diff --git a/distutils2/tests/test_command_sdist.py b/distutils2/tests/test_command_sdist.py
--- a/distutils2/tests/test_command_sdist.py
+++ b/distutils2/tests/test_command_sdist.py
@@ -45,7 +45,6 @@
MANIFEST = """\
# file GENERATED by distutils, do NOT edit
-README
inroot.txt
data%(sep)sdata.dt
scripts%(sep)sscript.py
@@ -141,7 +140,7 @@
zip_file.close()
# making sure everything has been pruned correctly
- self.assertEqual(len(content), 3)
+ self.assertEqual(len(content), 2)
@unittest.skipUnless(zlib, "requires zlib")
def test_make_distribution(self):
@@ -236,7 +235,7 @@
zip_file.close()
# making sure everything was added
- self.assertEqual(len(content), 10)
+ self.assertEqual(len(content), 9)
# checking the MANIFEST
manifest = open(join(self.tmp_dir, 'MANIFEST')).read()
@@ -362,8 +361,7 @@
if line.strip() != '']
finally:
f.close()
-
- self.assertEqual(len(manifest), 4)
+ self.assertEqual(len(manifest), 3)
# adding a file
self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#')
@@ -383,7 +381,7 @@
f.close()
# do we have the new file in MANIFEST ?
- self.assertEqual(len(manifest2), 5)
+ self.assertEqual(len(manifest2), 4)
self.assertIn('doc2.txt', manifest2[-1])
def test_manifest_marker(self):
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
@@ -280,7 +280,8 @@
def test_metadata_requires_description_files(self):
tempdir = self.mkdtemp()
os.chdir(tempdir)
- self.write_setup({'description-file': 'README\n README2', 'extra-files':'\n README2'})
+ self.write_setup({'description-file': 'README\n README2',
+ 'extra-files':'\n README2'})
self.write_file('README', 'yeah')
self.write_file('README2', 'yeah')
self.write_file('haven.py', '#')
@@ -302,10 +303,17 @@
cmd = sdist(dist)
cmd.finalize_options()
cmd.get_file_list()
+ self.assertRaises(DistutilsFileError, cmd.make_distribution)
+
+ self.write_setup({'description-file': 'README\n README2',
+ 'extra-files': '\n README2\n README'})
+ dist = self.run_setup('--description')
+ cmd = sdist(dist)
+ cmd.finalize_options()
+ cmd.get_file_list()
cmd.make_distribution()
self.assertIn('README\nREADME2\n', open('MANIFEST').read())
-
def test_sub_commands(self):
tempdir = self.mkdtemp()
os.chdir(tempdir)
diff --git a/distutils2/tests/test_markers.py b/distutils2/tests/test_markers.py
new file mode 100644
--- /dev/null
+++ b/distutils2/tests/test_markers.py
@@ -0,0 +1,69 @@
+"""Tests for distutils.metadata."""
+import os
+import sys
+import platform
+from StringIO import StringIO
+
+from distutils2.markers import interpret
+from distutils2.tests import run_unittest, unittest
+from distutils2.tests.support import LoggingCatcher, WarningsCatcher
+
+
+class MarkersTestCase(LoggingCatcher, WarningsCatcher,
+ unittest.TestCase):
+
+ def test_interpret(self):
+ sys_platform = sys.platform
+ version = sys.version.split()[0]
+ os_name = os.name
+ platform_version = platform.version()
+ platform_machine = platform.machine()
+
+ self.assertTrue(interpret("sys.platform == '%s'" % sys_platform))
+ self.assertTrue(interpret(
+ "sys.platform == '%s' or python_version == '2.4'" % sys_platform))
+ self.assertTrue(interpret(
+ "sys.platform == '%s' and python_full_version == '%s'" %
+ (sys_platform, version)))
+ self.assertTrue(interpret("'%s' == sys.platform" % sys_platform))
+ self.assertTrue(interpret('os.name == "%s"' % os_name))
+ self.assertTrue(interpret(
+ 'platform.version == "%s" and platform.machine == "%s"' %
+ (platform_version, platform_machine)))
+
+ # stuff that need to raise a syntax error
+ ops = ('os.name == os.name', 'os.name == 2', "'2' == '2'",
+ 'okpjonon', '', 'os.name ==', 'python_version == 2.4')
+ for op in ops:
+ self.assertRaises(SyntaxError, interpret, op)
+
+ # combined operations
+ OP = 'os.name == "%s"' % os_name
+ AND = ' and '
+ OR = ' or '
+ self.assertTrue(interpret(OP + AND + OP))
+ self.assertTrue(interpret(OP + AND + OP + AND + OP))
+ self.assertTrue(interpret(OP + OR + OP))
+ self.assertTrue(interpret(OP + OR + OP + OR + OP))
+
+ # other operators
+ self.assertTrue(interpret("os.name != 'buuuu'"))
+ self.assertTrue(interpret("python_version > '1.0'"))
+ self.assertTrue(interpret("python_version < '5.0'"))
+ self.assertTrue(interpret("python_version <= '5.0'"))
+ self.assertTrue(interpret("python_version >= '1.0'"))
+ self.assertTrue(interpret("'%s' in os.name" % os_name))
+ self.assertTrue(interpret("'buuuu' not in os.name"))
+ self.assertTrue(interpret(
+ "'buuuu' not in os.name and '%s' in os.name" % os_name))
+
+ # execution context
+ self.assertTrue(interpret('python_version == "0.1"',
+ {'python_version': '0.1'}))
+
+
+def test_suite():
+ return unittest.makeSuite(MarkersTestCase)
+
+if __name__ == '__main__':
+ run_unittest(test_suite())
diff --git a/distutils2/tests/test_metadata.py b/distutils2/tests/test_metadata.py
--- a/distutils2/tests/test_metadata.py
+++ b/distutils2/tests/test_metadata.py
@@ -1,10 +1,10 @@
-"""Tests for distutils.command.bdist."""
+"""Tests for distutils.metadata."""
import os
import sys
import platform
from StringIO import StringIO
-from distutils2.metadata import (DistributionMetadata, _interpret,
+from distutils2.metadata import (DistributionMetadata,
PKG_INFO_PREFERRED_VERSION)
from distutils2.tests import run_unittest, unittest
from distutils2.tests.support import LoggingCatcher, WarningsCatcher
@@ -46,55 +46,6 @@
self.assertRaises(TypeError, DistributionMetadata,
PKG_INFO, mapping=m, fileobj=fp)
- def test_interpret(self):
- sys_platform = sys.platform
- version = sys.version.split()[0]
- os_name = os.name
- platform_version = platform.version()
- platform_machine = platform.machine()
-
- self.assertTrue(_interpret("sys.platform == '%s'" % sys_platform))
- self.assertTrue(_interpret(
- "sys.platform == '%s' or python_version == '2.4'" % sys_platform))
- self.assertTrue(_interpret(
- "sys.platform == '%s' and python_full_version == '%s'" %
- (sys_platform, version)))
- self.assertTrue(_interpret("'%s' == sys.platform" % sys_platform))
- self.assertTrue(_interpret('os.name == "%s"' % os_name))
- self.assertTrue(_interpret(
- 'platform.version == "%s" and platform.machine == "%s"' %
- (platform_version, platform_machine)))
-
- # stuff that need to raise a syntax error
- ops = ('os.name == os.name', 'os.name == 2', "'2' == '2'",
- 'okpjonon', '', 'os.name ==', 'python_version == 2.4')
- for op in ops:
- self.assertRaises(SyntaxError, _interpret, op)
-
- # combined operations
- OP = 'os.name == "%s"' % os_name
- AND = ' and '
- OR = ' or '
- self.assertTrue(_interpret(OP + AND + OP))
- self.assertTrue(_interpret(OP + AND + OP + AND + OP))
- self.assertTrue(_interpret(OP + OR + OP))
- self.assertTrue(_interpret(OP + OR + OP + OR + OP))
-
- # other operators
- self.assertTrue(_interpret("os.name != 'buuuu'"))
- self.assertTrue(_interpret("python_version > '1.0'"))
- self.assertTrue(_interpret("python_version < '5.0'"))
- self.assertTrue(_interpret("python_version <= '5.0'"))
- self.assertTrue(_interpret("python_version >= '1.0'"))
- self.assertTrue(_interpret("'%s' in os.name" % os_name))
- self.assertTrue(_interpret("'buuuu' not in os.name"))
- self.assertTrue(_interpret(
- "'buuuu' not in os.name and '%s' in os.name" % os_name))
-
- # execution context
- self.assertTrue(_interpret('python_version == "0.1"',
- {'python_version': '0.1'}))
-
def test_metadata_read_write(self):
PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
metadata = DistributionMetadata(PKG_INFO)
diff --git a/docs/source/setupcfg.rst b/docs/source/setupcfg.rst
--- a/docs/source/setupcfg.rst
+++ b/docs/source/setupcfg.rst
@@ -128,6 +128,8 @@
This section describes the files included in the project.
+- **packages_root**: the root directory containing all packages. If not provided
+ Distutils2 will use the current directory. *\*optional*
- **packages**: a list of packages the project includes *\*optional* *\*multi*
- **modules**: a list of packages the project includes *\*optional* *\*multi*
- **scripts**: a list of scripts the project includes *\*optional* *\*multi*
@@ -136,6 +138,7 @@
Example::
[files]
+ packages_root = src
packages =
pypi2rpm
pypi2rpm.command
diff --git a/patch b/patch
deleted file mode 100644
--- a/patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff -r 5603e1bc5442 distutils2/util.py
---- a/distutils2/util.py Fri Jan 28 18:42:44 2011 +0100
-+++ b/distutils2/util.py Sat Jan 29 02:39:55 2011 +0100
-@@ -1203,12 +1203,13 @@
- in_cfg_value = has_get_option(config, section, option)
- if not in_cfg_value:
- # There is no such option in the setup.cfg
-- continue
--
-- if arg == "long_description":
-- filename = has_get_option("description_file")
-- if filename:
-- in_cfg_value = open(filename).read()
-+ if arg == "long_description":
-+ filename = has_get_option(config, section, "description_file")
-+ print "We have a filename", filename
-+ if filename:
-+ in_cfg_value = open(filename).read()
-+ else:
-+ continue
-
- if arg in MULTI_FIELDS:
- # Special behaviour when we have a multi line option
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list