From dfdfff1db15b41b81fbcf4817d4a0fe23664150b Mon Sep 17 00:00:00 2001 From: camielverdult Date: Tue, 7 May 2019 17:11:54 +0200 Subject: [PATCH 1/2] Add files --- .gitignore | 5 +++++ setup.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 894a44cc..571d19cc 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,8 @@ venv.bak/ # mypy .mypy_cache/ + +# py2app/py2exe +dist +build +ProperTree.py \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..28f803ca --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +from setuptools import setup +import os, sys + +ProperTree_PATH = os.path.dirname(os.path.realpath(__file__)) +SCRIPTS_PATH = ProperTree_PATH + "/Scripts" +FILES = os.listdir(ProperTree_PATH) +PT_FILE = "ProperTree.py" + +if not PT_FILE in FILES: + if "ProperTree.command" in FILES: + with open("ProperTree.command", 'r') as f: + pt = f.readlines() + pt.pop(0) + pt = "".join(pt) + with open(PT_FILE, 'w') as p: + p.write(pt) + p.close() + + f.close() + +APP = [PT_FILE] +DATA_FILES = ["Scripts/{}".format(x) for x in os.listdir(SCRIPTS_PATH)] +OPTIONS = {'argv_emulation': True} + +if sys.platform == 'darwin': + setup( + app=APP, + data_files=DATA_FILES, + options={'py2app': OPTIONS}, + setup_requires=['py2app'], + ) +elif sys.platform == 'win32': + setup( + app=APP, + data_files=DATA_FILES, + options={'py2exe': OPTIONS}, + setup_requires=['py2exe'], + ) + +print("\n\nApp can be found in {}/dist/ProperTree".format(ProperTree_PATH)) \ No newline at end of file From f68a94b6503c5e3f3eead6e111521e199d9f3c91 Mon Sep 17 00:00:00 2001 From: Camiel Date: Tue, 7 May 2019 17:15:07 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index f7d41808..c1bafb23 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,18 @@ # ProperTree Cross platform GUI plist editor written in python. + +## Binaries + +### Mac: +Install `py2app`: + +`pip install -U py2app`. + +To turn the main script into an application, run `sudo python setup.py py2app -A`. + +### Windows: +Install `py2exe`: + +`pip install -U py2exe`. + +To turn the main script into an executable, run `python setup.py py2exe -A` in CMD with administrator privileges