From aa765fee35a71528bc5beac9f5a9c776b88b6be2 Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Sat, 16 Feb 2013 19:02:05 +0100 Subject: [PATCH] Miglioramento del setup * Aggiunto un possibile supporto multipiattaforma. --- README.md | 6 +----- setup.py | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 67ae738..ff66651 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,4 @@ Per cancellare definitivamente un file basta spostarlo nel cestino mentre per ri È incluso un setup.py per convertire Dropchat.py in un binario tramite py2app o py2exe. Utilizzo: - python setup.py py2app - -o - - python setup.py py2exe \ No newline at end of file + python setup.py \ No newline at end of file diff --git a/setup.py b/setup.py index 878fc85..9c536a1 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,35 @@ -from setuptools import setup +import sys, setuptools -APP = ['dropchat.py'] -DATA_FILES = ['preferenze.json'] -OPTIONS = {'argv_emulation': False} +opzioni = { + "name": "Dropchat", + "version": "1.0", + "description": "Chat tramite dropbox.", + "author": "Rnhmjoj", + "author_email": "micheleguerinirocco@me.com", + "license": "MIT-GPL", + "app": ["Dropchat.py"], + "data_files": ["preferenze.json"], + "options": {}, + "setup_requires": ["py2app"], +} -setup( - app=APP, - data_files=DATA_FILES, - options={'py2app': OPTIONS}, - setup_requires=['py2app'], -) +if sys.platform == "darwin": + try: + import py2app + sys.argv += "py2app", + opzioni["options"] = {"py2app": {"argv_emulation": False}} + except ImportError: + exit("py2app non installato.") + +elif sys.platform == "win32": + try: + import py2exe + sys.argv += "py2exe", + opzioni["options"] = {"py2exe": {"bundle_files": 1, "compressed": True}} + except ImportError: + exit("py2exe non installato.") + +else: + exit("Sistema non supportato") + +setuptools.setup(**opzioni)