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
This commit is contained in:
Alberto Sottile 2019-04-13 15:39:55 +02:00 committed by Etoh
parent bcf8174b7d
commit 281d8023fd
90 changed files with 185 additions and 96 deletions

View File

@ -4,8 +4,8 @@ branches:
environment: environment:
MINICONDA: "C:\\Miniconda" MINICONDA: "C:\\Miniconda"
PYTHON: "C:\\Python35" PYTHON: "C:\\Python36"
PYTHON_VERSION: 3.5 PYTHON_VERSION: 3.6
PYTHON_ARCH: 32 PYTHON_ARCH: 32
platform: x86 platform: x86
@ -19,12 +19,12 @@ init:
- python --version - python --version
- python -m pip install -U pip setuptools wheel - python -m pip install -U pip setuptools wheel
- pip install -U pypiwin32==223 - pip install -U pypiwin32==223
- pip install twisted - pip install twisted[tls] certifi
- pip install zope.interface - pip install zope.interface
- type nul > %PYTHON%\lib\site-packages\zope\__init__.py - 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 - 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.2.2-py33.py34.py35-none-any.whl - pip install py2exe-0.9.3.0-cp36-none-win32.whl
- del py2exe-0.9.2.2-py33.py34.py35-none-any.whl - del py2exe-0.9.3.0-cp36-none-win32.whl
- pip install shiboken2==5.12.0 PySide2==5.12.0 - pip install shiboken2==5.12.0 PySide2==5.12.0
- pip freeze - pip freeze

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
*.exe *.exe
venv venv
/SyncPlay.egg-info /*.egg-info
/build /build
/cert /cert
/dist /dist

View File

@ -28,7 +28,7 @@ install:
before_deploy: before_deploy:
- pip3 install dmgbuild - pip3 install dmgbuild
- mkdir dist_dmg - 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}')" - export VER="$(cat syncplay/__init__.py | awk '/version/ {gsub("\047", "", $3); print $NF}')"
- dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}.dmg - dmgbuild -s appdmg.py "Syncplay" dist_dmg/Syncplay_${VER}.dmg
- python3 bintray_version.py - python3 bintray_version.py

View File

@ -35,18 +35,18 @@ endif
SHARE_PATH = ${DESTDIR}${PREFIX}/share SHARE_PATH = ${DESTDIR}${PREFIX}/share
common: 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 $(APP_SHORTCUT_PATH)
-mkdir -p $(SHARE_PATH)/app-install/icons -mkdir -p $(SHARE_PATH)/app-install/icons
-mkdir -p $(SHARE_PATH)/pixmaps/ -mkdir -p $(SHARE_PATH)/pixmaps/
cp -r syncplay $(LIB_PATH)/syncplay/ cp -r syncplay $(LIB_PATH)/syncplay/
chmod 755 $(LIB_PATH)/syncplay/ chmod 755 $(LIB_PATH)/syncplay/
cp -r resources/hicolor $(SHARE_PATH)/icons/ cp -r syncplay/resources/hicolor $(SHARE_PATH)/icons/
cp -r resources/*.png $(LIB_PATH)/syncplay/resources/ cp -r syncplay/resources/*.png $(LIB_PATH)/syncplay/syncplay/resources/
cp -r resources/*.lua $(LIB_PATH)/syncplay/resources/ cp -r syncplay/resources/*.lua $(LIB_PATH)/syncplay/syncplay/resources/
cp -r resources/lua/intf/*.lua $(LIB_PATH)/syncplay/resources/lua/intf/ cp -r syncplay/resources/lua/intf/*.lua $(LIB_PATH)/syncplay/syncplay/resources/lua/intf/
cp resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/app-install/icons/ cp syncplay/resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/app-install/icons/
cp resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/pixmaps/ cp syncplay/resources/hicolor/48x48/apps/syncplay.png $(SHARE_PATH)/pixmaps/
u-common: u-common:
-rm -rf $(LIB_PATH)/syncplay -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 sed -i -e '/# libpath/ a\import site\nsite.addsitedir\("${PREFIX}/lib/syncplay"\)' $(BIN_PATH)/syncplay
chmod 755 $(BIN_PATH)/syncplay chmod 755 $(BIN_PATH)/syncplay
cp syncplayClient.py $(LIB_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) ifeq ($(SINGLE_USER),false)
chmod 755 $(APP_SHORTCUT_PATH)/syncplay.desktop 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 sed -i -e '/# libpath/ a\import site\nsite.addsitedir\("${PREFIX}/lib/syncplay"\)' $(BIN_PATH)/syncplay-server
chmod 755 $(BIN_PATH)/syncplay-server chmod 755 $(BIN_PATH)/syncplay-server
cp syncplayServer.py $(LIB_PATH)/syncplay/ 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) ifeq ($(SINGLE_USER),false)
chmod 755 $(APP_SHORTCUT_PATH)/syncplay-server.desktop chmod 755 $(APP_SHORTCUT_PATH)/syncplay-server.desktop

6
MANIFEST.in Normal file
View File

@ -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

View File

@ -31,7 +31,7 @@ size = defines.get('size', None)
# Files to include # Files to include
files = [ files = [
application, application,
'resources/.macOS_readme.pdf' 'syncplay/resources/.macOS_readme.pdf'
] ]
# Symlinks to create # Symlinks to create
@ -78,7 +78,7 @@ icon_locations = {
# #
# Other color components may be expressed either in the range 0 to 1, or # Other color components may be expressed either in the range 0 to 1, or
# as percentages (e.g. 60% is equivalent to 0.6). # 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_status_bar = False
show_tab_view = False show_tab_view = False

View File

@ -11,11 +11,11 @@ import syncplay
APP = ['syncplayClient.py'] APP = ['syncplayClient.py']
DATA_FILES = [ DATA_FILES = [
('resources', glob('resources/*.png') + glob('resources/*.rtf') + glob('resources/*.lua')), ('resources', glob('syncplay/resources/*.png') + glob('syncplay/resources/*.rtf') + glob('syncplay/resources/*.lua')),
('resources/lua/intf', glob('resources/lua/intf/*.lua')) ('resources/lua/intf', glob('syncplay/resources/lua/intf/*.lua'))
] ]
OPTIONS = { OPTIONS = {
'iconfile': 'resources/icon.icns', 'iconfile': 'syncplay/resources/icon.icns',
'extra_scripts': 'syncplayServer.py', 'extra_scripts': 'syncplayServer.py',
'includes': {'PySide2.QtCore', 'PySide2.QtUiTools', 'PySide2.QtGui', 'PySide2.QtWidgets', 'certifi', 'cffi'}, 'includes': {'PySide2.QtCore', 'PySide2.QtUiTools', 'PySide2.QtGui', 'PySide2.QtWidgets', 'certifi', 'cffi'},
'excludes': {'PySide', 'PySide.QtCore', 'PySide.QtUiTools', 'PySide.QtGui'}, 'excludes': {'PySide', 'PySide.QtCore', 'PySide.QtUiTools', 'PySide.QtGui'},

29
buildPy2exe.py Normal file → Executable file
View File

@ -71,7 +71,7 @@ NSIS_SCRIPT_TEMPLATE = r"""
RequestExecutionLevel admin RequestExecutionLevel admin
ManifestDPIAware false ManifestDPIAware false
XPStyle on XPStyle on
Icon resources\icon.ico ;Change DIR Icon syncplay\resources\icon.ico ;Change DIR
SetCompressor /SOLID lzma SetCompressor /SOLID lzma
VIProductVersion "$version.0" VIProductVersion "$version.0"
@ -157,7 +157,7 @@ NSIS_SCRIPT_TEMPLATE = r"""
LangString ^ClickInstall $${LANG_GERMAN} " " LangString ^ClickInstall $${LANG_GERMAN} " "
PageEx license PageEx license
LicenseData resources\license.rtf LicenseData syncplay\resources\license.rtf
PageExEnd PageExEnd
Page custom DirectoryCustom DirectoryCustomLeave Page custom DirectoryCustom DirectoryCustomLeave
Page instFiles Page instFiles
@ -690,15 +690,18 @@ guiIcons = [
'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'
] ]
guiIcons = ['syncplay/' + s for s in guiIcons]
resources = [ resources = [
"resources/icon.ico", "syncplay/resources/icon.ico",
"resources/syncplay.png", "syncplay/resources/syncplay.png",
"resources/syncplayintf.lua", "syncplay/resources/syncplayintf.lua",
"resources/license.rtf", "syncplay/resources/license.rtf",
"resources/third-party-notices.rtf" "syncplay/resources/third-party-notices.rtf"
] ]
resources.extend(guiIcons) 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'] qt_plugins = ['platforms\\qwindows.dll', 'styles\\qwindowsvistastyle.dll']
@ -714,7 +717,7 @@ info = dict(
common_info, common_info,
windows=[{ windows=[{
"script": "syncplayClient.py", "script": "syncplayClient.py",
"icon_resources": [(1, "resources\\icon.ico")], "icon_resources": [(1, "syncplay\\resources\\icon.ico")],
'dest_base': "Syncplay"}, 'dest_base': "Syncplay"},
], ],
console=['syncplayServer.py'], console=['syncplayServer.py'],
@ -724,8 +727,8 @@ info = dict(
options={ options={
'py2exe': { 'py2exe': {
'dist_dir': OUT_DIR, 'dist_dir': OUT_DIR,
'packages': 'PySide2', 'packages': 'PySide2, cffi, OpenSSL, certifi',
'includes': 'twisted, sys, encodings, datetime, os, time, math, liburl, ast, unicodedata, _ssl, win32pipe, win32file', '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', 'excludes': 'venv, doctest, pdb, unittest, win32clipboard, win32pdh, win32security, win32trace, win32ui, winxpgui, win32process, Tkinter',
'dll_excludes': 'msvcr71.dll, MSVCP90.dll, POWRPROF.dll', 'dll_excludes': 'msvcr71.dll, MSVCP90.dll, POWRPROF.dll',
'optimize': 2, 'optimize': 2,
@ -737,5 +740,5 @@ info = dict(
cmdclass={"py2exe": build_installer}, cmdclass={"py2exe": build_installer},
) )
sys.argv.extend(['py2exe', '-p win32com ', '-i twisted.web.resource', '-p PySide2']) sys.argv.extend(['py2exe'])
setup(**info) setup(**info)

View File

@ -1,4 +1,5 @@
twisted>=16.4.0 certifi>=2018.11.29
twisted[tls]>=16.4.0
appnope>=0.1.0; sys_platform == 'darwin' appnope>=0.1.0; sys_platform == 'darwin'
pypiwin32>=223; sys_platform == 'win32' pypiwin32>=223; sys_platform == 'win32'
zope.inteface>=4.4.0; sys_platform == 'win32' zope.inteface>=4.4.0; sys_platform == 'win32'

View File

@ -1,2 +0,0 @@
certifi>=2018.11.29
twisted[tls]>=16.4.0

64
setup.py Normal file
View File

@ -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"
],
)

11
syncplay/ep_client.py Normal file
View File

@ -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()

58
syncplay/ep_server.py Normal file
View File

@ -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()

View File

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

View File

Before

Width:  |  Height:  |  Size: 581 B

After

Width:  |  Height:  |  Size: 581 B

View File

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 685 B

View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

View File

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 631 B

View File

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 349 B

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

Before

Width:  |  Height:  |  Size: 959 B

After

Width:  |  Height:  |  Size: 959 B

View File

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 512 B

View File

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

View File

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 557 B

View File

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 721 B

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

View File

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 715 B

View File

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

View File

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

View File

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

View File

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 666 B

View File

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B

View File

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 739 B

View File

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 855 B

View File

Before

Width:  |  Height:  |  Size: 1021 B

After

Width:  |  Height:  |  Size: 1021 B

View File

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 813 B

View File

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 830 B

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

View File

Before

Width:  |  Height:  |  Size: 792 B

After

Width:  |  Height:  |  Size: 792 B

View File

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 786 B

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 806 B

After

Width:  |  Height:  |  Size: 806 B

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

View File

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 884 B

View File

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 791 B

View File

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 862 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 890 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 759 B

View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

View File

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 758 B

View File

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 773 B

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 795 B

View File

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

View File

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

View File

Before

Width:  |  Height:  |  Size: 743 B

After

Width:  |  Height:  |  Size: 743 B

View File

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 834 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 940 B

After

Width:  |  Height:  |  Size: 940 B

View File

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 987 B

View File

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

View File

@ -147,7 +147,7 @@ def isASCII(s):
def findResourcePath(resourceName): def findResourcePath(resourceName):
if resourceName == "syncplay.lua": if resourceName == "syncplay.lua":
resourcePath = os.path.join(findWorkingDir(),"resources", "lua", "intf", resourceName) resourcePath = os.path.join(findWorkingDir(), "resources", "lua", "intf", resourceName)
else: else:
resourcePath = os.path.join(findWorkingDir(), "resources", resourceName) resourcePath = os.path.join(findWorkingDir(), "resources", resourceName)
return resourcePath return resourcePath
@ -156,7 +156,7 @@ def findResourcePath(resourceName):
def findWorkingDir(): def findWorkingDir():
frozen = getattr(sys, 'frozen', '') frozen = getattr(sys, 'frozen', '')
if not 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'): elif frozen in ('dll', 'console_exe', 'windows_exe', 'macosx_app'):
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
elif frozen: # needed for PyInstaller elif frozen: # needed for PyInstaller

View File

@ -11,9 +11,7 @@ except AttributeError:
import warnings import warnings
warnings.warn("You must run Syncplay with Python 3.4 or newer!") warnings.warn("You must run Syncplay with Python 3.4 or newer!")
from syncplay.clientManager import SyncplayClientManager from syncplay import ep_client
from syncplay.utils import blackholeStdoutForFrozenWindow
if __name__ == '__main__': if __name__ == '__main__':
blackholeStdoutForFrozenWindow() ep_client.main()
SyncplayClientManager().run()

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
#coding:utf8 #coding:utf8
import socket
import sys import sys
# libpath # libpath
@ -13,56 +12,7 @@ except AttributeError:
import warnings import warnings
warnings.warn("You must run Syncplay with Python 3.4 or newer!") warnings.warn("You must run Syncplay with Python 3.4 or newer!")
from twisted.internet import reactor from syncplay import ep_server
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.")
if __name__ == '__main__': if __name__ == '__main__':
argsGetter = ConfigurationGetter() ep_server.main()
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()