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):
if item.endswith('\r'): # Fix older sdists built on Windows
item = item[:-1]
path = convert_path(item)
if os.path.exists(path):
self.files.append(path)
try:
if os.path.exists(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):
by 'add_defaults()' and 'read_template()') to the manifest file
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
if os.sep!='/':
files = [f.replace(os.sep,'/') for f in files]
......@@ -360,7 +378,7 @@ def write_file (filename, contents):
"""
contents = "\n".join(contents)
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.write(contents)
f.close()
......
......@@ -283,7 +283,11 @@ class sdist(_sdist):
manifest = open(self.manifest, 'rbU')
for line in manifest:
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
line = line.strip()
if line.startswith('#') or not line:
......
......@@ -25,7 +25,7 @@ try:
except ImportError:
from setuptools.command.upload import upload
if sys.version_info >= (3,):
if sys.version_info >= (3, 1):
errors = 'surrogateescape'
else:
errors = 'strict'
......
......@@ -834,9 +834,8 @@ def open_with_auth(url):
# Double scheme does not raise on Mac OS X as revealed by a
# failing test. We would expect "nonnumeric port". Refs #20.
if sys.platform == 'darwin':
if netloc.endswith(':'):
raise httplib.InvalidURL("nonnumeric port: ''")
if netloc.endswith(':'):
raise httplib.InvalidURL("nonnumeric port: ''")
if scheme in ('http', 'https'):
auth, host = urllib2.splituser(netloc)
......
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