Edit folder structure and add setuptools support (#231)
* setuptools: Initial commit * setuptools: remove the .py extension from installed commands * setuptools: restructure scripts to use entry_points in setup.py * setuptools: include TLS dependencies and remove unneeded code * setuptools: change resources path * AppVeyor: upgrade Python and py2exe, embed TLS dependencies * buildpy2exe: fix path for resources * AppVeyor: upgrade py2exe and PySide2 * Amend setup.py according to the suggestions from PR #230 * Insert TLS dependencies in requirements * AppVeyor: fix build for master * AppVeyor: revert to PySide2 5.12.0
|
@ -4,8 +4,8 @@ branches:
|
|||
|
||||
environment:
|
||||
MINICONDA: "C:\\Miniconda"
|
||||
PYTHON: "C:\\Python35"
|
||||
PYTHON_VERSION: 3.5
|
||||
PYTHON: "C:\\Python36"
|
||||
PYTHON_VERSION: 3.6
|
||||
PYTHON_ARCH: 32
|
||||
|
||||
platform: x86
|
||||
|
@ -19,12 +19,12 @@ init:
|
|||
- python --version
|
||||
- python -m pip install -U pip setuptools wheel
|
||||
- pip install -U pypiwin32==223
|
||||
- pip install twisted
|
||||
- pip install twisted[tls] certifi
|
||||
- pip install zope.interface
|
||||
- type nul > %PYTHON%\lib\site-packages\zope\__init__.py
|
||||
- curl -L https://bintray.com/alby128/Syncplay/download_file?file_path=py2exe-0.9.2.2-py33.py34.py35-none-any.whl -o py2exe-0.9.2.2-py33.py34.py35-none-any.whl
|
||||
- pip install py2exe-0.9.2.2-py33.py34.py35-none-any.whl
|
||||
- del py2exe-0.9.2.2-py33.py34.py35-none-any.whl
|
||||
- curl -L https://bintray.com/alby128/py2exe/download_file?file_path=py2exe-0.9.3.0-cp36-none-win32.whl -o py2exe-0.9.3.0-cp36-none-win32.whl
|
||||
- pip install py2exe-0.9.3.0-cp36-none-win32.whl
|
||||
- del py2exe-0.9.3.0-cp36-none-win32.whl
|
||||
- pip install shiboken2==5.12.0 PySide2==5.12.0
|
||||
- pip freeze
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*.exe
|
||||
venv
|
||||
|
||||
/SyncPlay.egg-info
|
||||
/*.egg-info
|
||||
/build
|
||||
/cert
|
||||
/dist
|
||||
|
|
|
@ -28,7 +28,7 @@ install:
|
|||
before_deploy:
|
||||
- pip3 install dmgbuild
|
||||
- mkdir dist_dmg
|
||||
- mv resources/macOS_readme.pdf resources/.macOS_readme.pdf
|
||||
- mv syncplay/resources/macOS_readme.pdf syncplay/resources/.macOS_readme.pdf
|
||||
- export VER="$(cat syncplay/__init__.py | awk '/version/ {gsub("\047", "", $3); print $NF}')"
|
||||
- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}.dmg
|
||||
- python3 bintray_version.py
|
||||
|
|
18
GNUmakefile
|
@ -35,18 +35,18 @@ endif
|
|||
SHARE_PATH = ${DESTDIR}${PREFIX}/share
|
||||
|
||||
common:
|
||||
-mkdir -p $(LIB_PATH)/syncplay/resources/lua/intf
|
||||
-mkdir -p $(LIB_PATH)/syncplay/syncplay/resources/lua/intf
|
||||
-mkdir -p $(APP_SHORTCUT_PATH)
|
||||
-mkdir -p $(SHARE_PATH)/app-install/icons
|
||||
-mkdir -p $(SHARE_PATH)/pixmaps/
|
||||
cp -r syncplay $(LIB_PATH)/syncplay/
|
||||
chmod 755 $(LIB_PATH)/syncplay/
|
||||
cp -r resources/hicolor $(SHARE_PATH)/icons/
|
||||
cp -r resources/*.png $(LIB_PATH)/syncplay/resources/
|
||||
cp -r resources/*.lua $(LIB_PATH)/syncplay/resources/
|
||||
cp -r resources/lua/intf/*.lua $(LIB_PATH)/syncplay/resources/lua/intf/
|
||||
cp resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/app-install/icons/
|
||||
cp resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/pixmaps/
|
||||
cp -r syncplay/resources/hicolor $(SHARE_PATH)/icons/
|
||||
cp -r syncplay/resources/*.png $(LIB_PATH)/syncplay/syncplay/resources/
|
||||
cp -r syncplay/resources/*.lua $(LIB_PATH)/syncplay/syncplay/resources/
|
||||
cp -r syncplay/resources/lua/intf/*.lua $(LIB_PATH)/syncplay/syncplay/resources/lua/intf/
|
||||
cp syncplay/resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/app-install/icons/
|
||||
cp syncplay/resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/pixmaps/
|
||||
|
||||
u-common:
|
||||
-rm -rf $(LIB_PATH)/syncplay
|
||||
|
@ -60,7 +60,7 @@ client:
|
|||
sed -i -e '/# libpath/ a\import site\nsite.addsitedir\("${PREFIX}/lib/syncplay"\)' $(BIN_PATH)/syncplay
|
||||
chmod 755 $(BIN_PATH)/syncplay
|
||||
cp syncplayClient.py $(LIB_PATH)/syncplay/
|
||||
cp resources/syncplay.desktop $(APP_SHORTCUT_PATH)/
|
||||
cp syncplay/resources/syncplay.desktop $(APP_SHORTCUT_PATH)/
|
||||
|
||||
ifeq ($(SINGLE_USER),false)
|
||||
chmod 755 $(APP_SHORTCUT_PATH)/syncplay.desktop
|
||||
|
@ -79,7 +79,7 @@ server:
|
|||
sed -i -e '/# libpath/ a\import site\nsite.addsitedir\("${PREFIX}/lib/syncplay"\)' $(BIN_PATH)/syncplay-server
|
||||
chmod 755 $(BIN_PATH)/syncplay-server
|
||||
cp syncplayServer.py $(LIB_PATH)/syncplay/
|
||||
cp resources/syncplay-server.desktop $(APP_SHORTCUT_PATH)/
|
||||
cp syncplay/resources/syncplay-server.desktop $(APP_SHORTCUT_PATH)/
|
||||
|
||||
ifeq ($(SINGLE_USER),false)
|
||||
chmod 755 $(APP_SHORTCUT_PATH)/syncplay-server.desktop
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
include LICENSE
|
||||
include syncplay/resources/*.png
|
||||
include syncplay/resources/*.mng
|
||||
include syncplay/resources/*.lua
|
||||
include syncplay/resources/*.rtf
|
||||
include syncplay/resources/lua/intf/*.lua
|
|
@ -31,7 +31,7 @@ size = defines.get('size', None)
|
|||
# Files to include
|
||||
files = [
|
||||
application,
|
||||
'resources/.macOS_readme.pdf'
|
||||
'syncplay/resources/.macOS_readme.pdf'
|
||||
]
|
||||
|
||||
# Symlinks to create
|
||||
|
@ -78,7 +78,7 @@ icon_locations = {
|
|||
#
|
||||
# Other color components may be expressed either in the range 0 to 1, or
|
||||
# as percentages (e.g. 60% is equivalent to 0.6).
|
||||
background = 'resources/macOS_dmg_bkg.tiff'
|
||||
background = 'syncplay/resources/macOS_dmg_bkg.tiff'
|
||||
|
||||
show_status_bar = False
|
||||
show_tab_view = False
|
||||
|
|
|
@ -11,11 +11,11 @@ import syncplay
|
|||
|
||||
APP = ['syncplayClient.py']
|
||||
DATA_FILES = [
|
||||
('resources', glob('resources/*.png') + glob('resources/*.rtf') + glob('resources/*.lua')),
|
||||
('resources/lua/intf', glob('resources/lua/intf/*.lua'))
|
||||
('resources', glob('syncplay/resources/*.png') + glob('syncplay/resources/*.rtf') + glob('syncplay/resources/*.lua')),
|
||||
('resources/lua/intf', glob('syncplay/resources/lua/intf/*.lua'))
|
||||
]
|
||||
OPTIONS = {
|
||||
'iconfile': 'resources/icon.icns',
|
||||
'iconfile': 'syncplay/resources/icon.icns',
|
||||
'extra_scripts': 'syncplayServer.py',
|
||||
'includes': {'PySide2.QtCore', 'PySide2.QtUiTools', 'PySide2.QtGui', 'PySide2.QtWidgets', 'certifi', 'cffi'},
|
||||
'excludes': {'PySide', 'PySide.QtCore', 'PySide.QtUiTools', 'PySide.QtGui'},
|
||||
|
|
|
@ -71,7 +71,7 @@ NSIS_SCRIPT_TEMPLATE = r"""
|
|||
RequestExecutionLevel admin
|
||||
ManifestDPIAware false
|
||||
XPStyle on
|
||||
Icon resources\icon.ico ;Change DIR
|
||||
Icon syncplay\resources\icon.ico ;Change DIR
|
||||
SetCompressor /SOLID lzma
|
||||
|
||||
VIProductVersion "$version.0"
|
||||
|
@ -157,7 +157,7 @@ NSIS_SCRIPT_TEMPLATE = r"""
|
|||
LangString ^ClickInstall $${LANG_GERMAN} " "
|
||||
|
||||
PageEx license
|
||||
LicenseData resources\license.rtf
|
||||
LicenseData syncplay\resources\license.rtf
|
||||
PageExEnd
|
||||
Page custom DirectoryCustom DirectoryCustomLeave
|
||||
Page instFiles
|
||||
|
@ -690,15 +690,18 @@ guiIcons = [
|
|||
'resources/email_go.png',
|
||||
'resources/world_add.png', 'resources/film_add.png', 'resources/delete.png', 'resources/spinner.mng'
|
||||
]
|
||||
|
||||
guiIcons = ['syncplay/' + s for s in guiIcons]
|
||||
|
||||
resources = [
|
||||
"resources/icon.ico",
|
||||
"resources/syncplay.png",
|
||||
"resources/syncplayintf.lua",
|
||||
"resources/license.rtf",
|
||||
"resources/third-party-notices.rtf"
|
||||
"syncplay/resources/icon.ico",
|
||||
"syncplay/resources/syncplay.png",
|
||||
"syncplay/resources/syncplayintf.lua",
|
||||
"syncplay/resources/license.rtf",
|
||||
"syncplay/resources/third-party-notices.rtf"
|
||||
]
|
||||
resources.extend(guiIcons)
|
||||
intf_resources = ["resources/lua/intf/syncplay.lua"]
|
||||
intf_resources = ["syncplay/resources/lua/intf/syncplay.lua"]
|
||||
|
||||
qt_plugins = ['platforms\\qwindows.dll', 'styles\\qwindowsvistastyle.dll']
|
||||
|
||||
|
@ -714,7 +717,7 @@ info = dict(
|
|||
common_info,
|
||||
windows=[{
|
||||
"script": "syncplayClient.py",
|
||||
"icon_resources": [(1, "resources\\icon.ico")],
|
||||
"icon_resources": [(1, "syncplay\\resources\\icon.ico")],
|
||||
'dest_base': "Syncplay"},
|
||||
],
|
||||
console=['syncplayServer.py'],
|
||||
|
@ -724,8 +727,8 @@ info = dict(
|
|||
options={
|
||||
'py2exe': {
|
||||
'dist_dir': OUT_DIR,
|
||||
'packages': 'PySide2',
|
||||
'includes': 'twisted, sys, encodings, datetime, os, time, math, liburl, ast, unicodedata, _ssl, win32pipe, win32file',
|
||||
'packages': 'PySide2, cffi, OpenSSL, certifi',
|
||||
'includes': 'twisted, sys, encodings, datetime, os, time, math, urllib, ast, unicodedata, _ssl, win32pipe, win32file',
|
||||
'excludes': 'venv, doctest, pdb, unittest, win32clipboard, win32pdh, win32security, win32trace, win32ui, winxpgui, win32process, Tkinter',
|
||||
'dll_excludes': 'msvcr71.dll, MSVCP90.dll, POWRPROF.dll',
|
||||
'optimize': 2,
|
||||
|
@ -737,5 +740,5 @@ info = dict(
|
|||
cmdclass={"py2exe": build_installer},
|
||||
)
|
||||
|
||||
sys.argv.extend(['py2exe', '-p win32com ', '-i twisted.web.resource', '-p PySide2'])
|
||||
setup(**info)
|
||||
sys.argv.extend(['py2exe'])
|
||||
setup(**info)
|
|
@ -1,4 +1,5 @@
|
|||
twisted>=16.4.0
|
||||
certifi>=2018.11.29
|
||||
twisted[tls]>=16.4.0
|
||||
appnope>=0.1.0; sys_platform == 'darwin'
|
||||
pypiwin32>=223; sys_platform == 'win32'
|
||||
zope.inteface>=4.4.0; sys_platform == 'win32'
|
|
@ -1,2 +0,0 @@
|
|||
certifi>=2018.11.29
|
||||
twisted[tls]>=16.4.0
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import distutils.command.install_scripts
|
||||
import setuptools
|
||||
|
||||
from syncplay import projectURL, version as syncplay_version
|
||||
|
||||
def read(fname):
|
||||
with open(fname, 'r') as f:
|
||||
return f.read()
|
||||
|
||||
installRequirements = read('requirements.txt').splitlines() +\
|
||||
read('requirements_gui.txt').splitlines()
|
||||
|
||||
setuptools.setup(
|
||||
name="syncplay",
|
||||
version=syncplay_version,
|
||||
author="Syncplay",
|
||||
author_email="dev@syncplay.pl",
|
||||
description=' '.join([
|
||||
'Client/server to synchronize media playback',
|
||||
'on mpv/VLC/MPC-HC/MPC-BE on many computers'
|
||||
]),
|
||||
long_description=read('README.md'),
|
||||
long_description_content_type="text/markdown",
|
||||
url=projectURL,
|
||||
download_url=projectURL + 'download/',
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=installRequirements,
|
||||
python_requires=">=3.4",
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'syncplay-server = syncplay.ep_server:main',
|
||||
],
|
||||
'gui_scripts': [
|
||||
'syncplay = syncplay.ep_client:main',
|
||||
]
|
||||
},
|
||||
include_package_data=True,
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: MacOS X :: Cocoa",
|
||||
"Environment :: Win32 (MS Windows)",
|
||||
"Environment :: X11 Applications :: Qt",
|
||||
"Framework :: Twisted",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Natural Language :: English",
|
||||
"Natural Language :: German",
|
||||
"Natural Language :: Italian",
|
||||
"Natural Language :: Russian",
|
||||
"Natural Language :: Spanish",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Topic :: Internet",
|
||||
"Topic :: Multimedia :: Video"
|
||||
],
|
||||
)
|
|
@ -0,0 +1,11 @@
|
|||
import sys
|
||||
|
||||
from syncplay.clientManager import SyncplayClientManager
|
||||
from syncplay.utils import blackholeStdoutForFrozenWindow
|
||||
|
||||
def main():
|
||||
blackholeStdoutForFrozenWindow()
|
||||
SyncplayClientManager().run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,58 @@
|
|||
import socket
|
||||
import sys
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.endpoints import TCP4ServerEndpoint, TCP6ServerEndpoint
|
||||
from twisted.internet.error import CannotListenError
|
||||
|
||||
from syncplay.server import SyncFactory, ConfigurationGetter
|
||||
|
||||
class ServerStatus: pass
|
||||
|
||||
def isListening6(f):
|
||||
ServerStatus.listening6 = True
|
||||
|
||||
def isListening4(f):
|
||||
ServerStatus.listening4 = True
|
||||
|
||||
def failed6(f):
|
||||
ServerStatus.listening6 = False
|
||||
print(f.value)
|
||||
print("IPv6 listening failed.")
|
||||
|
||||
def failed4(f):
|
||||
ServerStatus.listening4 = False
|
||||
if f.type is CannotListenError and ServerStatus.listening6:
|
||||
pass
|
||||
else:
|
||||
print(f.value)
|
||||
print("IPv4 listening failed.")
|
||||
|
||||
def main():
|
||||
argsGetter = ConfigurationGetter()
|
||||
args = argsGetter.getConfiguration()
|
||||
factory = SyncFactory(
|
||||
args.port,
|
||||
args.password,
|
||||
args.motd_file,
|
||||
args.isolate_rooms,
|
||||
args.salt,
|
||||
args.disable_ready,
|
||||
args.disable_chat,
|
||||
args.max_chat_message_length,
|
||||
args.max_username_length,
|
||||
args.stats_db_file,
|
||||
args.tls
|
||||
)
|
||||
endpoint6 = TCP6ServerEndpoint(reactor, int(args.port))
|
||||
endpoint6.listen(factory).addCallbacks(isListening6, failed6)
|
||||
endpoint4 = TCP4ServerEndpoint(reactor, int(args.port))
|
||||
endpoint4.listen(factory).addCallbacks(isListening4, failed4)
|
||||
if ServerStatus.listening6 or ServerStatus.listening4:
|
||||
reactor.run()
|
||||
else:
|
||||
print("Unable to listen using either IPv4 and IPv6 protocols. Quitting the server now.")
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Before Width: | Height: | Size: 781 B After Width: | Height: | Size: 781 B |
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 581 B |
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 685 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 631 B After Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 959 B After Width: | Height: | Size: 959 B |
Before Width: | Height: | Size: 512 B After Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 847 B |
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 717 B After Width: | Height: | Size: 717 B |
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 715 B |
Before Width: | Height: | Size: 693 B After Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 754 B |
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 666 B After Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 750 B |
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 739 B |
Before Width: | Height: | Size: 855 B After Width: | Height: | Size: 855 B |
Before Width: | Height: | Size: 1021 B After Width: | Height: | Size: 1021 B |
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 679 B |
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 792 B |
Before Width: | Height: | Size: 786 B After Width: | Height: | Size: 786 B |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 806 B |
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 884 B |
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 791 B |
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 824 B After Width: | Height: | Size: 824 B |
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 890 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 931 B After Width: | Height: | Size: 931 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 759 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 795 B After Width: | Height: | Size: 795 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 743 B After Width: | Height: | Size: 743 B |
Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 834 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 940 B After Width: | Height: | Size: 940 B |
Before Width: | Height: | Size: 987 B After Width: | Height: | Size: 987 B |
Before Width: | Height: | Size: 944 B After Width: | Height: | Size: 944 B |
|
@ -147,7 +147,7 @@ def isASCII(s):
|
|||
|
||||
def findResourcePath(resourceName):
|
||||
if resourceName == "syncplay.lua":
|
||||
resourcePath = os.path.join(findWorkingDir(),"resources", "lua", "intf", resourceName)
|
||||
resourcePath = os.path.join(findWorkingDir(), "resources", "lua", "intf", resourceName)
|
||||
else:
|
||||
resourcePath = os.path.join(findWorkingDir(), "resources", resourceName)
|
||||
return resourcePath
|
||||
|
@ -156,7 +156,7 @@ def findResourcePath(resourceName):
|
|||
def findWorkingDir():
|
||||
frozen = getattr(sys, 'frozen', '')
|
||||
if not frozen:
|
||||
path = os.path.dirname(os.path.dirname(__file__))
|
||||
path = os.path.dirname(__file__)
|
||||
elif frozen in ('dll', 'console_exe', 'windows_exe', 'macosx_app'):
|
||||
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
elif frozen: # needed for PyInstaller
|
||||
|
|
|
@ -11,9 +11,7 @@ except AttributeError:
|
|||
import warnings
|
||||
warnings.warn("You must run Syncplay with Python 3.4 or newer!")
|
||||
|
||||
from syncplay.clientManager import SyncplayClientManager
|
||||
from syncplay.utils import blackholeStdoutForFrozenWindow
|
||||
from syncplay import ep_client
|
||||
|
||||
if __name__ == '__main__':
|
||||
blackholeStdoutForFrozenWindow()
|
||||
SyncplayClientManager().run()
|
||||
ep_client.main()
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
#coding:utf8
|
||||
|
||||
import socket
|
||||
import sys
|
||||
|
||||
# libpath
|
||||
|
@ -13,56 +12,7 @@ except AttributeError:
|
|||
import warnings
|
||||
warnings.warn("You must run Syncplay with Python 3.4 or newer!")
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.endpoints import TCP4ServerEndpoint, TCP6ServerEndpoint
|
||||
from twisted.internet.error import CannotListenError
|
||||
|
||||
from syncplay.server import SyncFactory, ConfigurationGetter
|
||||
|
||||
class ServerStatus: pass
|
||||
|
||||
def isListening6(f):
|
||||
ServerStatus.listening6 = True
|
||||
|
||||
def isListening4(f):
|
||||
ServerStatus.listening4 = True
|
||||
|
||||
def failed6(f):
|
||||
ServerStatus.listening6 = False
|
||||
print(f.value)
|
||||
print("IPv6 listening failed.")
|
||||
|
||||
def failed4(f):
|
||||
ServerStatus.listening4 = False
|
||||
if f.type is CannotListenError and ServerStatus.listening6:
|
||||
pass
|
||||
else:
|
||||
print(f.value)
|
||||
print("IPv4 listening failed.")
|
||||
|
||||
from syncplay import ep_server
|
||||
|
||||
if __name__ == '__main__':
|
||||
argsGetter = ConfigurationGetter()
|
||||
args = argsGetter.getConfiguration()
|
||||
factory = SyncFactory(
|
||||
args.port,
|
||||
args.password,
|
||||
args.motd_file,
|
||||
args.isolate_rooms,
|
||||
args.salt,
|
||||
args.disable_ready,
|
||||
args.disable_chat,
|
||||
args.max_chat_message_length,
|
||||
args.max_username_length,
|
||||
args.stats_db_file,
|
||||
args.tls
|
||||
)
|
||||
endpoint6 = TCP6ServerEndpoint(reactor, int(args.port))
|
||||
endpoint6.listen(factory).addCallbacks(isListening6, failed6)
|
||||
endpoint4 = TCP4ServerEndpoint(reactor, int(args.port))
|
||||
endpoint4.listen(factory).addCallbacks(isListening4, failed4)
|
||||
if ServerStatus.listening6 or ServerStatus.listening4:
|
||||
reactor.run()
|
||||
else:
|
||||
print("Unable to listen using either IPv4 and IPv6 protocols. Quitting the server now.")
|
||||
sys.exit()
|
||||
ep_server.main()
|