diff --git a/setup.py b/setup.py index e8cc4de8c..0355afd0b 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,6 @@ import os.path import warnings import sys import glob -import io -import zipfile try: from setuptools import setup @@ -27,15 +25,6 @@ except ImportError: exit(1) -def zipped_folder(topdir): - f = io.BytesIO() - zipf = zipfile.ZipFile(f, mode='w') - for dirpath, dirnames, filenames in os.walk(topdir): - for filename in filenames: - zipf.write(os.path.join(dirpath, filename)) - zipf.close() - return f.getvalue() - py2exe_options = { "bundle_files": 1, "compressed": 1, @@ -47,7 +36,6 @@ py2exe_options = { py2exe_console = [{ "script": "./youtube_dl/__main__.py", "dest_base": "youtube-dl", - "other_resources": [(u'LOCALE_DATA', u'locale_data.zip', zipped_folder('share'))], }] py2exe_params = { diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 04aa917d8..b7d2043a7 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -32,7 +32,6 @@ import sys import tempfile import traceback import xml.etree.ElementTree -import zipfile import zlib from .compat import ( @@ -2514,36 +2513,12 @@ class ISO3166Utils(object): return cls._country_map.get(code.upper()) -def _load_exe_resource(res_type, res_name): - kernel32 = ctypes.windll.kernel32 - - exe_handle = 0 # NULL: Current process - - res_info = kernel32.FindResourceW(exe_handle, res_name, res_type) - res_handle = kernel32.LoadResource(exe_handle, res_info) - res_data = kernel32.LockResource(res_handle) - res_len = kernel32.SizeofResource(exe_handle, res_info) - res_arr = ctypes.cast(res_data, ctypes.POINTER(ctypes.c_char))[:res_len] - return res_arr - - def g(s): DOMAIN = 'youtube_dl' lang, _ = locale.getdefaultlocale() try: t = gettext.translation(DOMAIN, find_file_in_root('share/locale/'), [lang]) except (OSError, IOError): # OSError for 3.3+ and IOError otherwise - t = None - - if t is None and sys.platform == 'win32' and hasattr(sys, 'frozen'): - locale_data_zip = _load_exe_resource('LOCALE_DATA', 'LOCALE_DATA.ZIP') - f = io.BytesIO(locale_data_zip) - zipf = zipfile.ZipFile(f) - with zipf.open('share/locale/%s/LC_MESSAGES/%s.mo' % (lang, DOMAIN)) as mo_file: - t = gettext.GNUTranslations(mo_file) - zipf.close() - - if t is None: return s ret = t.gettext(s)