Bundle .mo files into a Windows EXE resource
This commit is contained in:
parent
7309cee4a0
commit
f344e796f8
13
setup.py
13
setup.py
@ -6,6 +6,8 @@ from __future__ import print_function
|
||||
import os.path
|
||||
import warnings
|
||||
import sys
|
||||
import io
|
||||
import zipfile
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
@ -23,6 +25,16 @@ except ImportError:
|
||||
print("Cannot import py2exe", file=sys.stderr)
|
||||
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,
|
||||
@ -34,6 +46,7 @@ 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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user