-
-
-# build the sdist target
-if cmd not in "py2exe py2app cx_freeze".split():
- f = open("MANIFEST.in","w")
- for l in data: f.write("include "+l+"\n")
- for l in src: f.write("include "+l+"\n")
- f.close()
-
- setup(**PACKAGEDATA)
-
-# build the py2exe target
-if cmd in ('py2exe',):
- dist_dir = os.path.join('dist',METADATA['py2exe.target'])
- data_dir = dist_dir
-
- src = 'run_game.py'
- dest = METADATA['py2exe.binary']+'.py'
- shutil.copy(src,dest)
-
- setup(
- options={'py2exe':{
- 'dist_dir':dist_dir,
- 'dll_excludes':['_dotblas.pyd','_numpy.pyd', 'numpy.linalg.lapack_lite.pyd', 'numpy.core._dotblas.pyd'] + files_to_remove,
- 'excludes':['matplotlib', 'tcl', 'OpenGL'],
- 'ignores':['matplotlib', 'tcl', 'OpenGL'],
- 'bundle_files':1,
- }},
-# windows=[{
- console=[{
- 'script':dest,
- #'icon_resources':[(1,METADATA['py2exe.icon'])],
- }],
- )
-
-# build the py2app target
-if cmd == 'py2app':
- dist_dir = os.path.join('dist',METADATA['py2app.target']+'.app')
- data_dir = os.path.join(dist_dir,'Contents','Resources')
- from setuptools import setup
-
- src = 'run_game.py'
- dest = METADATA['py2app.target']+'.py'
- shutil.copy(src,dest)
-
- APP = [dest]
- DATA_FILES = []
- OPTIONS = {'argv_emulation': True,
- #'iconfile':METADATA['py2app.icon']
- }
-
- setup(
- app=APP,
- data_files=DATA_FILES,
- options={'py2app': OPTIONS},
- setup_requires=['py2app'],
- )
-
-# make the cx_freeze target
-if cmd == 'cx_freeze':
- app_dist_dir = METADATA['cx_freeze.target'] + "_" + METADATA['version']
- dist_dir = os.path.join('dist', app_dist_dir)
- data_dir = dist_dir
-
- modules_exclude = "tcl,tk"
- cmd_args = (METADATA['cx_freeze.cmd'], dist_dir, METADATA['cx_freeze.binary'], modules_exclude)
- sys_cmd = '%s --install-dir=%s --target-name=%s --exclude-modules=%s run_game.py' % cmd_args
- print sys_cmd
- os.system(sys_cmd)
-
- import shutil
- if os.path.exists(os.path.join(data_dir, "tcl")):
- shutil.rmtree( os.path.join(data_dir, "tcl") )
- if os.path.exists(os.path.join(data_dir, "tk")):
- shutil.rmtree( os.path.join(data_dir, "tk") )
-
-
-
-# recursively make a bunch of folders
-def make_dirs(dname_):
- parts = list(os.path.split(dname_))
- dname = None
- while len(parts):
- if dname == None:
- dname = parts.pop(0)
- else:
- dname = os.path.join(dname,parts.pop(0))
- if not os.path.isdir(dname):
- os.mkdir(dname)
-
-# copy data into the binaries
-if cmd in ('py2exe','cx_freeze','py2app'):
- dest = data_dir
- for fname in data:
- dname = os.path.join(dest,os.path.dirname(fname))
- make_dirs(dname)
- if not os.path.isdir(fname):
- #print (fname,dname)
- shutil.copy(fname,dname)
-
-# make a tgz files.
-if cmd == 'cx_freeze':
- sys_cmd = "cd dist; tar -vczf %s.tgz %s/" % (app_dist_dir,app_dist_dir)
- os.system(sys_cmd)
-
-
-# remove files from the zip.
-if 0 and cmd in ('py2exe'):
- import shutil
-
- #shutil.rmtree( os.path.join('dist') )
- #shutil.rmtree( os.path.join('build') )
-
-
- os.system("unzip dist/library.zip -d dist\library")
-
- for fn in files_to_remove:
- os.remove( os.path.join('dist', 'library', fn) )
-
-
- for d in directories_to_remove:
- if os.path.exists( os.path.join('dist', 'library', d) ):
- shutil.rmtree( os.path.join('dist', 'library', d) )
-
- os.remove( os.path.join('dist', 'library.zip') )
-
-
- os.chdir("dist")
- os.chdir("library")
-
- os.system("zip -r -9 ..\library.zip .")
-
- os.chdir("..")
- os.chdir("..")
+setup(
+ name="tabakrolletjie",
+ version="1.0.0",
+ url='http://ctpug.org.za/gitweb/tabakrolletjie',
+ license='BSD',
+ description="An entry for Pyweek 22.",
+ long_description=open('README.txt', 'r').read(),
+ author='CTPUG',
+ author_email='ctpug@googlegroups.com',
+ packages=find_packages(),
+ include_package_data=True,
+ install_requires=[
+ 'pygame',
+ 'pymunk',
+ ],
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: End Users/Desktop',
+ 'License :: OSI Approved :: ISC License (ISCL)',
+ 'Operating System :: POSIX',
+ 'Operating System :: Microsoft :: Windows',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.7',
+ 'Topic :: Games/Entertainment',
+ ],
+ # py2exe
+ windows=[{
+ 'script': 'scripts/tabakrolletjie',
+ 'icon_resources': [(0, "data/images/icons/tabakrolletjie_icon.ico")],
+ }],
+ options={
+ 'py2exe': {
+ 'skip_archive': 1,
+ 'dist_dir': 'dist/tabakrolletjie-1.0.0',
+ 'packages': [
+ 'logging', 'encodings', 'tabakrolletjie',
+ ],
+ 'includes': [
+ 'pygame', 'pymunk',
+ ],
+ 'excludes': [
+ 'numpy',
+ ],
+ 'ignores': [
+ # all database modules
+ 'pgdb', 'Sybase', 'adodbapi',
+ 'kinterbasdb', 'psycopg', 'psycopg2', 'pymssql',
+ 'sapdb', 'pysqlite2', 'sqlite', 'sqlite3',
+ 'MySQLdb', 'MySQLdb.connections',
+ 'MySQLdb.constants.CR', 'MySQLdb.constants.ER',
+ # old datetime equivalents
+ 'DateTime', 'DateTime.ISO',
+ 'mx', 'mx.DateTime', 'mx.DateTime.ISO',
+ # email modules
+ 'email.Generator', 'email.Iterators', 'email.Utils',
+ ],
+ },
+ }
+)