Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Unified Diff: Lib/packaging/util.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/packaging/tests/test_util.py ('k') | Lib/platform.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/packaging/util.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/packaging/util.py Mon Jul 25 09:47:18 2011 -0400
@@ -757,9 +757,6 @@
else:
return path, ''
-if sys.platform == 'darwin':
- _cfg_target = None
- _cfg_target_split = None
def spawn(cmd, search_path=True, verbose=0, dry_run=False, env=None):
"""Run another program specified as a command list 'cmd' in a new process.
@@ -784,26 +781,6 @@
if dry_run:
logging.debug('dry run, no process actually spawned')
return
- if sys.platform == 'darwin':
- global _cfg_target, _cfg_target_split
- if _cfg_target is None:
- _cfg_target = sysconfig.get_config_var(
- 'MACOSX_DEPLOYMENT_TARGET') or ''
- if _cfg_target:
- _cfg_target_split = [int(x) for x in _cfg_target.split('.')]
- if _cfg_target:
- # ensure that the deployment target of build process is not less
- # than that used when the interpreter was built. This ensures
- # extension modules are built with correct compatibility values
- env = env or os.environ
- cur_target = env.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
- if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
- my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
- 'now "%s" but "%s" during configure'
- % (cur_target, _cfg_target))
- raise PackagingPlatformError(my_msg)
- env = dict(env, MACOSX_DEPLOYMENT_TARGET=cur_target)
-
exit_status = subprocess.call(cmd, env=env)
if exit_status != 0:
msg = "command %r failed with exit status %d"
@@ -1487,50 +1464,3 @@
_path_created.add(abs_head)
return created_dirs
-
-
-def encode_multipart(fields, files, boundary=None):
- """Prepare a multipart HTTP request.
-
- *fields* is a sequence of (name: str, value: str) elements for regular
- form fields, *files* is a sequence of (name: str, filename: str, value:
- bytes) elements for data to be uploaded as files.
-
- Returns (content_type: bytes, body: bytes) ready for http.client.HTTP.
- """
- # Taken from
- # http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/
-
- if boundary is None:
- boundary = b'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
- elif not isinstance(boundary, bytes):
- raise TypeError('boundary must be bytes, not %r' % type(boundary))
-
- l = []
- for key, values in fields:
- # handle multiple entries for the same name
- if not isinstance(values, (tuple, list)):
- values=[values]
-
- for value in values:
- l.extend((
- b'--' + boundary,
- ('Content-Disposition: form-data; name="%s"' %
- key).encode('utf-8'),
- b'',
- value.encode('utf-8')))
-
- for key, filename, value in files:
- l.extend((
- b'--' + boundary,
- ('Content-Disposition: form-data; name="%s"; filename="%s"' %
- (key, filename)).encode('utf-8'),
- b'',
- value))
-
- l.append(b'--' + boundary + b'--')
- l.append(b'')
-
- body = b'\r\n'.join(l)
- content_type = b'multipart/form-data; boundary=' + boundary
- return content_type, body
« no previous file with comments | « Lib/packaging/tests/test_util.py ('k') | Lib/platform.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+