pyinstaller

This commit is contained in:
Jack Robison 2018-10-18 12:31:36 -04:00
parent 42bcf83b2d
commit 9824cbd410
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 65 additions and 2 deletions

View file

@ -30,3 +30,45 @@ jobs:
- <<: *tests
name: "Unit Tests w/ Python 3.6"
python: "3.6"
- &build
name: "Linux"
python: "3.6"
install:
- pip install pyinstaller
- pip install -e .
script:
- pyinstaller -F -n aioupnp aioupnp/__main__.py
- chmod +x dist/aioupnp
- zip -j dist/aioupnp-${OS}.zip dist/aioupnp
env: OS=linux
addons:
artifacts:
working_dir: dist
paths:
- aioupnp-${OS}.zip
- <<: *build
name: "Mac"
os: osx
osx_image: xcode9.4
language: generic
env: OS=mac
- <<: *build
name: "Windows"
language: generic
services:
- docker
install:
- docker pull cdrx/pyinstaller-windows:python3-32bit
script:
- docker run -v "$(pwd):/src/aioupnp" cdrx/pyinstaller-windows:python3-32bit aioupnp/wine_build.sh
- sudo zip -j dist/aioupnp-windows.zip dist/aioupnp.exe
addons:
artifacts:
working_dir: dist
paths:
- aioupnp-windows.zip

View file

@ -335,11 +335,17 @@ class UPnP:
kwargs = kwargs or {}
igd_args = igd_args
timeout = int(timeout)
close_loop = False
try:
asyncio.get_running_loop()
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
close_loop = True
if not loop and not close_loop:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
close_loop = True
fut: asyncio.Future = asyncio.Future()
@ -374,7 +380,10 @@ class UPnP:
if not hasattr(UPnP, method) or not hasattr(getattr(UPnP, method), "_cli"):
fut.set_exception(UPnPError("\"%s\" is not a recognized command" % method))
wrapper = lambda : None
asyncio.run(wrapper())
loop.run_until_complete(wrapper())
if close_loop:
loop.close()
try:
result = fut.result()
except UPnPError as err:

12
wine_build.sh Executable file
View file

@ -0,0 +1,12 @@
set -x
rm -rf /tmp/.wine-*
apt-get -qq update
apt-get -qq install -y git
pip install setuptools_scm
cd aioupnp
pip install -e .
pyinstaller -F -n aioupnp aioupnp/__main__.py