Created
January 28, 2014 00:06
-
-
Save tomprince/8659952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contrib/build-installer b/contrib/build-installer | |
index 47f4c6b..b350969 100755 | |
--- a/contrib/build-installer | |
+++ b/contrib/build-installer | |
@@ -40,18 +40,18 @@ tmpdir = None | |
try: | |
# Create a temporary working directory | |
tmpdir = tempfile.mkdtemp() | |
+ get_pip = os.path.join(tmpdir, "get-pip.py") | |
# Unpack the zipfile into the temporary directory | |
- with open(os.path.join(tmpdir, "get-pip.py"), "wb") as fp: | |
+ with open(get_pip, "wb") as fp: | |
fp.write(base64.decodestring(ZIPFILE)) | |
# Execute the unpacked zip script using the same interpreter as we're | |
# currently using. | |
- p = subprocess.Popen([sys.executable, os.path.join(tmpdir, "get-pip.py")]) | |
- p.wait() | |
- | |
- # Exit the script with the exit code that our zip script had | |
- sys.exit(p.returncode) | |
+ import zipimport, sys | |
+ sys.meta_path.insert(0, zipimport.zipimporter(get_pip)) | |
+ from bootstrap_pip import bootstrap | |
+ boostrap() | |
finally: | |
# Clean up our temporary working directory | |
if tmpdir: | |
@@ -134,7 +134,7 @@ def main(): | |
z.write(os.path.join(toplevel, filename), filename) | |
# Give the zip archive a __main__.py that will execute the bootstrap | |
- z.writestr("__main__.py", BOOTSTRAP_SCRIPT) | |
+ z.writestr("bootstrap_pip.py", BOOTSTRAP_SCRIPT) | |
# Get the binary data that compromises our zip file | |
with open(get_pip, "rb") as fp: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment