aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/sdist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/sdist.py')
-rwxr-xr-xsetuptools/command/sdist.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index f9a5b7b9..2aa1ee20 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -1,14 +1,14 @@
+from glob import glob
+from distutils.util import convert_path
+from distutils import log
+import distutils.command.sdist as orig
import os
import re
import sys
-from glob import glob
-import pkg_resources
-import distutils.command.sdist as orig
-from distutils.util import convert_path
-from distutils import log
from setuptools import svn_utils
from setuptools.compat import PY3
+import pkg_resources
READMES = ('README', 'README.rst', 'README.txt')
@@ -20,7 +20,7 @@ def walk_revctrl(dirname=''):
yield item
-#TODO will need test case
+# TODO will need test case
class re_finder(object):
"""
Finder that locates files based on entries in a file matched by a
@@ -33,7 +33,7 @@ class re_finder(object):
self.entries_path = convert_path(path)
def _finder(self, dirname, filename):
- f = open(filename,'rU')
+ f = open(filename, 'rU')
try:
data = f.read()
finally:
@@ -51,12 +51,13 @@ class re_finder(object):
if not os.path.isfile(path):
# entries file doesn't exist
return
- for path in self._finder(dirname,path):
+ for path in self._finder(dirname, path):
if os.path.isfile(path):
yield path
elif os.path.isdir(path):
for item in self.find(path):
yield item
+
__call__ = find
@@ -85,7 +86,7 @@ class sdist(orig.sdist):
('dist-dir=', 'd',
"directory to put the source distribution archive(s) in "
"[default: dist]"),
- ]
+ ]
negative_opt = {}
@@ -93,7 +94,7 @@ class sdist(orig.sdist):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
self.filelist = ei_cmd.filelist
- self.filelist.append(os.path.join(ei_cmd.egg_info,'SOURCES.txt'))
+ self.filelist.append(os.path.join(ei_cmd.egg_info, 'SOURCES.txt'))
self.check_readme()
# Run sub commands
@@ -103,12 +104,13 @@ class sdist(orig.sdist):
# Call check_metadata only if no 'check' command
# (distutils <= 2.6)
import distutils.command
+
if 'check' not in distutils.command.__all__:
self.check_metadata()
self.make_distribution()
- dist_files = getattr(self.distribution,'dist_files',[])
+ dist_files = getattr(self.distribution, 'dist_files', [])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
@@ -124,13 +126,14 @@ class sdist(orig.sdist):
except:
sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close()
raise
+
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# has been fixed, so only override the method if we're using an earlier
# Python.
has_leaky_handle = (
- sys.version_info < (2,7,2)
- or (3,0) <= sys.version_info < (3,1,4)
- or (3,2) <= sys.version_info < (3,2,1)
+ sys.version_info < (2, 7, 2)
+ or (3, 0) <= sys.version_info < (3, 1, 4)
+ or (3, 2) <= sys.version_info < (3, 2, 1)
)
if has_leaky_handle:
read_template = __read_template_hack
@@ -194,7 +197,8 @@ class sdist(orig.sdist):
return
else:
self.warn(
- "standard file not found: should have one of " +', '.join(READMES)
+ "standard file not found: should have one of " +
+ ', '.join(READMES)
)
def make_release_tree(self, base_dir, files):
@@ -202,7 +206,7 @@ class sdist(orig.sdist):
# Save any egg_info command line options used to create this sdist
dest = os.path.join(base_dir, 'setup.cfg')
- if hasattr(os,'link') and os.path.exists(dest):
+ if hasattr(os, 'link') and os.path.exists(dest):
# unlink and re-copy, since it might be hard-linked, and
# we don't want to change the source version
os.unlink(dest)
@@ -220,7 +224,8 @@ class sdist(orig.sdist):
first_line = fp.readline()
finally:
fp.close()
- return first_line != '# file GENERATED by distutils, do NOT edit\n'.encode()
+ return (first_line !=
+ '# file GENERATED by distutils, do NOT edit\n'.encode())
def read_manifest(self):
"""Read the manifest file (named by 'self.manifest') and use it to