Fix formatting

This commit is contained in:
Daniel Ahn 2018-07-20 15:37:31 -07:00
parent db1cfd12f0
commit b4d02e3686

View File

@ -6,7 +6,8 @@
# 1) If you get the error "ImportError: No module named zope.interface" then add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory # 1) If you get the error "ImportError: No module named zope.interface" then add an empty __init__.py file to the PYTHONDIR/Lib/site-packages/zope directory
# 2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed. # 2) It is expected that you will have NSIS 3 NSIS from http://nsis.sourceforge.net installed.
import sys, codecs import codecs
import sys
# try: # try:
# if (sys.version_info.major != 2) or (sys.version_info.minor < 7): # if (sys.version_info.major != 2) or (sys.version_info.minor < 7):
# raise Exception("You must build Syncplay with Python 2.7!") # raise Exception("You must build Syncplay with Python 2.7!")
@ -14,23 +15,26 @@ import sys, codecs
# import warnings # import warnings
# warnings.warn("You must build Syncplay with Python 2.7!") # warnings.warn("You must build Syncplay with Python 2.7!")
import os
import subprocess
from string import Template
from distutils.core import setup from distutils.core import setup
try: try:
from py2exe.build_exe import py2exe from py2exe.build_exe import py2exe
except ImportError: except ImportError:
from py2exe.distutils_buildexe import py2exe from py2exe.distutils_buildexe import py2exe
from string import Template
import syncplay import syncplay
import os
import subprocess
from syncplay.messages import getMissingStrings from syncplay.messages import getMissingStrings
missingStrings = getMissingStrings() missingStrings = getMissingStrings()
if missingStrings is not None and missingStrings is not "": if missingStrings is not None and missingStrings is not "":
import warnings import warnings
warnings.warn("MISSING/UNUSED STRINGS DETECTED:\n{}".format(missingStrings)) warnings.warn("MISSING/UNUSED STRINGS DETECTED:\n{}".format(missingStrings))
def get_nsis_path(): def get_nsis_path():
bin_name = "makensis.exe" bin_name = "makensis.exe"
from winreg import HKEY_LOCAL_MACHINE as HKLM from winreg import HKEY_LOCAL_MACHINE as HKLM
@ -44,6 +48,8 @@ def get_nsis_path():
raise Exception("You must install NSIS 3 or later.") raise Exception("You must install NSIS 3 or later.")
except WindowsError: except WindowsError:
return bin_name return bin_name
NSIS_COMPILE = get_nsis_path() NSIS_COMPILE = get_nsis_path()
OUT_DIR = "syncplay_v{}".format(syncplay.version) OUT_DIR = "syncplay_v{}".format(syncplay.version)
@ -613,6 +619,7 @@ NSIS_SCRIPT_TEMPLATE = r"""
SectionEnd SectionEnd
""" """
class NSISScript(object): class NSISScript(object):
def create(self): def create(self):
fileList, totalSize = self.getBuildDirContents(OUT_DIR) fileList, totalSize = self.getBuildDirContents(OUT_DIR)
@ -669,6 +676,7 @@ class NSISScript(object):
delete.append('RMdir "$INSTDIR\\{}"'.format(file_)) delete.append('RMdir "$INSTDIR\\{}"'.format(file_))
return "\n".join(delete) return "\n".join(delete)
class build_installer(py2exe): class build_installer(py2exe):
def run(self): def run(self):
py2exe.run(self) py2exe.run(self)
@ -678,7 +686,9 @@ class build_installer(py2exe):
script.compile() script.compile()
print("*** DONE ***") print("*** DONE ***")
guiIcons = ['resources/accept.png', 'resources/arrow_undo.png', 'resources/clock_go.png',
guiIcons = [
'resources/accept.png', 'resources/arrow_undo.png', 'resources/clock_go.png',
'resources/control_pause_blue.png', 'resources/cross.png', 'resources/door_in.png', 'resources/control_pause_blue.png', 'resources/cross.png', 'resources/door_in.png',
'resources/folder_explore.png', 'resources/help.png', 'resources/table_refresh.png', 'resources/folder_explore.png', 'resources/help.png', 'resources/table_refresh.png',
'resources/timeline_marker.png', 'resources/control_play_blue.png', 'resources/timeline_marker.png', 'resources/control_play_blue.png',
@ -700,7 +710,13 @@ guiIcons = ['resources/accept.png', 'resources/arrow_undo.png', 'resources/clock
'resources/email_go.png', 'resources/email_go.png',
'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng' 'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng'
] ]
resources = ["resources/icon.ico", "resources/syncplay.png", "resources/syncplayintf.lua", "resources/license.rtf", "resources/third-party-notices.rtf"] resources = [
"resources/icon.ico",
"resources/syncplay.png",
"resources/syncplayintf.lua",
"resources/license.rtf",
"resources/third-party-notices.rtf"
]
resources.extend(guiIcons) resources.extend(guiIcons)
intf_resources = ["resources/lua/intf/syncplay.lua"] intf_resources = ["resources/lua/intf/syncplay.lua"]
@ -714,11 +730,16 @@ common_info = dict(
info = dict( info = dict(
common_info, common_info,
windows=[{"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"},], windows=[{
"script": "syncplayClient.py",
"icon_resources": [(1, "resources\\icon.ico")],
'dest_base': "Syncplay"},
],
console=['syncplayServer.py'], console=['syncplayServer.py'],
# *** If you wish to make the Syncplay client use console mode (for --no-gui to work) then comment out the above two lines and uncomment the following line: # *** If you wish to make the Syncplay client use console mode (for --no-gui to work) then comment out the above two lines and uncomment the following line:
# console=['syncplayServer.py', {"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"}], # console=['syncplayServer.py', {"script":"syncplayClient.py", "icon_resources":[(1, "resources\\icon.ico")], 'dest_base': "Syncplay"}],
options={'py2exe': { options={
'py2exe': {
'dist_dir': OUT_DIR, 'dist_dir': OUT_DIR,
'packages': 'PySide.QtUiTools', 'packages': 'PySide.QtUiTools',
'includes': 'twisted, sys, encodings, datetime, os, time, math, PySide, liburl, ast, unicodedata, _ssl', 'includes': 'twisted, sys, encodings, datetime, os, time, math, PySide, liburl, ast, unicodedata, _ssl',