mirror of
https://github.com/timsutton/brigadier.git
synced 2025-05-28 05:54:53 -04:00
Windows build script support for PyInstaller 2.1
This commit is contained in:
parent
7412efcfc2
commit
aaca3c484d
1 changed files with 9 additions and 14 deletions
|
@ -14,7 +14,7 @@ import subprocess
|
|||
import shutil
|
||||
import hashlib
|
||||
|
||||
PYINSTALLER_URL = 'http://sourceforge.net/projects/pyinstaller/files/2.0/pyinstaller-2.0.zip/download'
|
||||
PYINSTALLER_URL = 'https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.zip'
|
||||
PYINST_ZIPFILE = os.path.join(os.getcwd(), 'pyinstaller.zip')
|
||||
NAME = 'brigadier'
|
||||
|
||||
|
@ -22,9 +22,8 @@ with open('VERSION', 'r') as fd:
|
|||
version = fd.read().strip()
|
||||
name_versioned = NAME + '-' + version
|
||||
exe_name = NAME + '.exe'
|
||||
spec_dir = os.path.join(os.getcwd(), 'spec')
|
||||
dist_dir = os.path.join(spec_dir, 'dist')
|
||||
pack_dir = os.path.join(os.getcwd(), name_versioned)
|
||||
build_dir = os.path.join(os.getcwd(), 'build')
|
||||
|
||||
need_pyinstaller = False
|
||||
if os.path.exists(PYINST_ZIPFILE):
|
||||
|
@ -42,23 +41,19 @@ if need_pyinstaller:
|
|||
urllib.urlretrieve(PYINSTALLER_URL, filename=PYINST_ZIPFILE)
|
||||
|
||||
dlzip = ZipFile(PYINST_ZIPFILE)
|
||||
pyinst_root = dlzip.namelist()[0].strip('/')
|
||||
pyinst_root = dlzip.namelist()[0].split("/")[0]
|
||||
dlzip.extractall()
|
||||
|
||||
print "Building version %s..." % version
|
||||
build_cmd = [os.path.join(os.environ["SYSTEMDRIVE"] + "\\", 'Python27', 'python.exe'),
|
||||
os.path.join(os.getcwd(), pyinst_root, 'pyinstaller.py'),
|
||||
'-F',
|
||||
'--out', spec_dir,
|
||||
'--name', NAME,
|
||||
'brigadier']
|
||||
'-F',
|
||||
'--distpath', pack_dir,
|
||||
'--name', NAME,
|
||||
'brigadier']
|
||||
subprocess.call(build_cmd)
|
||||
|
||||
print "Compressing to zip file..."
|
||||
if not os.path.isdir(pack_dir):
|
||||
os.mkdir(pack_dir)
|
||||
os.rename(os.path.join(dist_dir, exe_name),
|
||||
os.path.join(pack_dir, exe_name))
|
||||
zipfile_name = name_versioned + '.zip'
|
||||
packzip = ZipFile(zipfile_name, 'w')
|
||||
packzip.write(os.path.basename(pack_dir))
|
||||
|
@ -68,11 +63,11 @@ with open(zipfile_name, 'r') as zipfd:
|
|||
sha1 = hashlib.sha1(zipfd.read()).hexdigest()
|
||||
|
||||
print "Cleaning up..."
|
||||
for dirs in [pack_dir, spec_dir, pyinst_root]:
|
||||
for dirs in [pack_dir, build_dir, pyinst_root]:
|
||||
shutil.rmtree(dirs)
|
||||
for f in os.listdir(os.getcwd()):
|
||||
if f.startswith('logdict'):
|
||||
os.remove(f)
|
||||
|
||||
print "Built and archived to %s." % zipfile_name
|
||||
print "SHA1: %s" % sha1
|
||||
print "SHA1: %s" % sha1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue