Commit 1705c621 authored by Stefan H. Holek's avatar Stefan H. Holek

Merge tarek/distribute.

--HG--
branch : distribute
extra : rebase_source : ae93a9075ce18033307175abba2e9715fd3b9b01
parents 83b2066a 397eda9b
...@@ -281,8 +281,14 @@ class FileList(_FileList): ...@@ -281,8 +281,14 @@ class FileList(_FileList):
if item.endswith('\r'): # Fix older sdists built on Windows if item.endswith('\r'): # Fix older sdists built on Windows
item = item[:-1] item = item[:-1]
path = convert_path(item) path = convert_path(item)
try:
if os.path.exists(path): if os.path.exists(path):
self.files.append(path) self.files.append(path)
else:
log.warn("%r not found -- skipping", path)
except UnicodeEncodeError:
log.warn("%r not %s encodable -- skipping", path,
sys.getfilesystemencoding())
...@@ -323,6 +329,18 @@ class manifest_maker(sdist): ...@@ -323,6 +329,18 @@ class manifest_maker(sdist):
by 'add_defaults()' and 'read_template()') to the manifest file by 'add_defaults()' and 'read_template()') to the manifest file
named by 'self.manifest'. named by 'self.manifest'.
""" """
# The manifest must be UTF-8 encodable. See #303.
if sys.version_info >= (3,):
files = []
for file in self.filelist.files:
try:
file.encode("utf-8")
except UnicodeEncodeError:
log.warn("'%s' not UTF-8 encodable -- skipping" % file)
else:
files.append(file)
self.filelist.files = files
files = self.filelist.files files = self.filelist.files
if os.sep!='/': if os.sep!='/':
files = [f.replace(os.sep,'/') for f in files] files = [f.replace(os.sep,'/') for f in files]
...@@ -360,7 +378,7 @@ def write_file (filename, contents): ...@@ -360,7 +378,7 @@ def write_file (filename, contents):
""" """
contents = "\n".join(contents) contents = "\n".join(contents)
if sys.version_info >= (3,): if sys.version_info >= (3,):
contents = contents.encode("utf-8", "surrogateescape") contents = contents.encode("utf-8")
f = open(filename, "wb") # always write POSIX-style manifest f = open(filename, "wb") # always write POSIX-style manifest
f.write(contents) f.write(contents)
f.close() f.close()
......
...@@ -283,7 +283,11 @@ class sdist(_sdist): ...@@ -283,7 +283,11 @@ class sdist(_sdist):
manifest = open(self.manifest, 'rbU') manifest = open(self.manifest, 'rbU')
for line in manifest: for line in manifest:
if sys.version_info >= (3,): if sys.version_info >= (3,):
line = line.decode('UTF-8', 'surrogateescape') try:
line = line.decode('UTF-8')
except UnicodeDecodeError:
log.warn("%r not UTF-8 decodable -- skipping" % line)
continue
# ignore comments and blank lines # ignore comments and blank lines
line = line.strip() line = line.strip()
if line.startswith('#') or not line: if line.startswith('#') or not line:
......
...@@ -25,7 +25,7 @@ try: ...@@ -25,7 +25,7 @@ try:
except ImportError: except ImportError:
from setuptools.command.upload import upload from setuptools.command.upload import upload
if sys.version_info >= (3,): if sys.version_info >= (3, 1):
errors = 'surrogateescape' errors = 'surrogateescape'
else: else:
errors = 'strict' errors = 'strict'
......
...@@ -834,7 +834,6 @@ def open_with_auth(url): ...@@ -834,7 +834,6 @@ def open_with_auth(url):
# Double scheme does not raise on Mac OS X as revealed by a # Double scheme does not raise on Mac OS X as revealed by a
# failing test. We would expect "nonnumeric port". Refs #20. # failing test. We would expect "nonnumeric port". Refs #20.
if sys.platform == 'darwin':
if netloc.endswith(':'): if netloc.endswith(':'):
raise httplib.InvalidURL("nonnumeric port: ''") raise httplib.InvalidURL("nonnumeric port: ''")
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment