compatibility fixes to make a standalone exe work

pull/13/head
Mike Fährmann 8 years ago
parent 4553a6392f
commit 37d4d07d9b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -8,6 +8,7 @@
"""Common classes and constants used by extractor modules."""
import os
import time
import queue
import requests
@ -94,3 +95,21 @@ def safe_request(session, url, method="GET", *args, **kwargs):
# everything ok -- proceed to download
return r
# The first import of requests happens inside this file.
# If we are running on Windows and the from requests expected certificate file
# is missing (which happens in a standalone executable from py2exe), the
# requests.Session object gets monkey patched to always set its 'verify'
# attribute to False to avoid an exception being thrown when attempting to
# access https:// URLs.
if os.name == "nt":
import os.path
import requests.certs
if not os.path.isfile(requests.certs.where()):
def patched_init(self):
session_init(self)
self.verify = False
session_init = requests.Session.__init__
requests.Session.__init__ = patched_init

@ -19,7 +19,7 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor):
filename_fmt = "{filename}"
pattern = [r"(?:https?://)?downloads\.khinsider\.com/game-soundtracks/album/(.+)"]
test = [("http://downloads.khinsider.com/game-soundtracks/album/horizon-riders-wii-", {
"url": "35ff4c8310884664408dc5560fda3b06157f7606",
"url": "732639e9e72e169f8ec36a71609471aaf67451e0",
"keyword": "d91cf3edee6713b536eaf3995743f0be7dc72f68",
})]

@ -30,7 +30,7 @@ if "py2exe" in sys.argv:
import py2exe
except ImportError:
print("Error importing 'py2exe'", file=sys.stderr)
sys.exit(1)
exit(1)
params = {
"console": [{
"script": "./gallery_dl/__main__.py",
@ -42,14 +42,14 @@ if "py2exe" in sys.argv:
"product_version": __version__,
}],
"options": {"py2exe": {
"bundle_files": 1,
"bundle_files": 0,
"compressed": 1,
"optimize": 2,
"dist_dir": ".",
"packages": ["gallery_dl"],
"dll_excludes": ["w9xpopen.exe", "crypt32.dll"],
"dll_excludes": ["w9xpopen.exe"],
}},
"zipfile": None
"zipfile": None,
}
elif has_setuptools:
params = {

Loading…
Cancel
Save