Browse Source

Setup.py prenant en compte cx_freeze

pull/55/head
Luthaf 10 years ago
parent
commit
1d455b6b34
  1. 86
      setup.py

86
setup.py

@ -4,8 +4,6 @@
$ python setup.py install $ python setup.py install
""" """
from distutils.core import setup
from distutils.command.install import install as _install
from patacrep import __STR_VERSION__ from patacrep import __STR_VERSION__
import sys import sys
@ -13,52 +11,21 @@ import os
import site import site
def link_songbook(): SETUP = {"name": 'songbook-core',
if sys.platform.startswith('darwin'): "version": __STR_VERSION__,
source = os.path.join(site.PREFIXES[0], "description": 'Songbook compilation chain',
'bin', "author": 'The Songbook team',
'songbook') "author_email": 'crep@team-on-fire.com',
dest = '/usr/local/bin/songbook' "url": 'https://github.com/patacrep/songbook-core',
if os.path.isfile(dest): "packages": ['patacrep'],
print("File {dest} already exist, skipping.".format(dest=dest)) "license": "GPLv2 or any later version",
else: "scripts": ['songbook'],
os.symlink(source, dest) "requires": [
elif sys.platform.startswith('win32'):
script = os.path.join(site.PREFIXES[0],
'Scripts',
'songbook')
dest = script + '.py'
bat_name = script + '.bat'
if os.path.isfile(dest):
os.unlink(dest)
os.rename(script, dest)
content = "python {songbook} %* \n".format(songbook=dest)
with open(bat_name, 'w') as bat_file:
bat_file.write(content)
class install(_install):
def run(self):
_install.run(self)
link_songbook()
setup(cmdclass={'install': install},
name='patacrep',
version=__STR_VERSION__,
description='Songbook compilation chain',
author='The Patacrep team',
author_email='crep@team-on-fire.com',
url='https://github.com/patacrep/patacrep',
packages=['patacrep', 'patacrep.content'],
license="GPLv2 or any later version",
scripts=['songbook'],
requires=[
"argparse", "codecs", "distutils", "fnmatch", "glob", "json", "argparse", "codecs", "distutils", "fnmatch", "glob", "json",
"locale", "logging", "os", "plasTeX", "re", "subprocess", "sys", "locale", "logging", "os", "plasTeX", "re", "subprocess", "sys",
"textwrap", "unidecode", "jinja2" "textwrap", "unidecode", "jinja2", "chardet"
], ],
package_data={'patacrep': ['data/latex/*', "package_data": {'patacrep': [ 'data/latex/*',
'data/templates/*', 'data/templates/*',
'data/examples/*.sb', 'data/examples/*.sb',
'data/examples/*/*.sg', 'data/examples/*/*.sg',
@ -67,7 +34,7 @@ setup(cmdclass={'install': install},
'data/examples/*/*.png', 'data/examples/*/*.png',
'data/examples/*/*.png', 'data/examples/*/*.png',
'data/examples/*/*/header']}, 'data/examples/*/*/header']},
classifiers=[ "classifiers": [
"Environment :: Console", "Environment :: Console",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Natural Language :: English", "Natural Language :: English",
@ -77,5 +44,28 @@ setup(cmdclass={'install': install},
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
"Topic :: Utilities", "Topic :: Utilities",
], ],
platforms=["GNU/Linux", "Windows", "MacOsX"], "platforms": ["GNU/Linux", "Windows", "MacOsX"]
) }
if sys.platform.startswith('win32'):
try:
from cx_Freeze import setup, Executable
exe = Executable(script="songbook")
except ImportError:
# Only a source installation will be possible
from distutils.core import setup
exe = None
build_options = {'build_exe': {
"include_files": ["plasTeX/", "patacrep/"],
"excludes": ["plasTeX"],
"includes": ["UserList", "UserString", "new", "ConfigParser"]
}}
SETUP.update({"options": build_options,
"executables": [exe],
"package_data": {},
})
else:
from distutils.core import setup
setup(**SETUP)

Loading…
Cancel
Save