Another variant of windows install, using a dynamically created .bat file.

This commit is contained in:
Griatch 2015-02-02 17:42:24 +01:00
parent fbcb616086
commit 2b82260927
2 changed files with 21 additions and 3 deletions

View File

@ -1 +0,0 @@
@"python" "bin\evennia.py" %*

View File

@ -1,8 +1,11 @@
import os
import sys
from setuptools import setup, find_packages
os.chdir(os.path.dirname(os.path.realpath(__file__)))
VERSION_PATH = os.path.join('evennia', 'VERSION.txt')
def get_requirements():
"""
@ -17,7 +20,23 @@ def get_requirements():
reqs.append(line)
return reqs
VERSION_PATH = os.path.join('evennia', 'VERSION.txt')
def get_scripts():
"""
Determine which executable scripts should be added. For Windows,
this means creating a .bat file.
"""
execlist = []
if os.name == "nt":
# Windows
with open(os.path("bin", "evennia.bat"), "w") as bat_file:
bat_file.write("@\"%s\" \"%s\" %%*" % (sys.executable, os.path.join("bin/python.py")))
execlist.append("bin/evennia.bat")
else:
# Linux, Mac
execlist.append("bin/evennia")
execlist.append("bin/evennia_runner.py")
return execlist
def get_version():
@ -49,7 +68,7 @@ setup(
version=get_version(),
description='A full-featured MUD building toolkit.',
packages=find_packages(),
scripts=['bin/evennia', 'bin/evennia.bat', 'bin/evennia_runner.py'],
scripts=get_scripts(),
install_requires=get_requirements(),
package_data={'': package_data()},
zip_safe=False