2022-11-18 22:07:43 +01:00
|
|
|
"""
|
|
|
|
|
Do custom actions during build/install step.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2015-01-14 17:21:15 -06:00
|
|
|
import os
|
2015-02-02 17:42:24 +01:00
|
|
|
import sys
|
2022-11-10 22:21:12 +01:00
|
|
|
|
2022-11-18 22:07:43 +01:00
|
|
|
from setuptools import setup
|
2015-01-14 17:21:15 -06:00
|
|
|
|
2015-03-07 20:57:50 +01:00
|
|
|
OS_WINDOWS = os.name == "nt"
|
2015-01-14 17:21:15 -06:00
|
|
|
|
2015-09-07 10:32:05 -07:00
|
|
|
|
2022-11-18 22:07:43 +01:00
|
|
|
def get_evennia_executable():
|
2015-01-16 08:19:33 -06:00
|
|
|
"""
|
2022-11-18 22:07:43 +01:00
|
|
|
Called from build process.
|
2015-02-02 17:42:24 +01:00
|
|
|
|
|
|
|
|
Determine which executable scripts should be added. For Windows,
|
|
|
|
|
this means creating a .bat file.
|
2022-11-18 22:07:43 +01:00
|
|
|
|
2015-02-02 17:42:24 +01:00
|
|
|
"""
|
2015-03-07 20:57:50 +01:00
|
|
|
if OS_WINDOWS:
|
2015-02-02 20:54:26 +01:00
|
|
|
batpath = os.path.join("bin", "windows", "evennia.bat")
|
2015-03-01 12:43:36 +01:00
|
|
|
scriptpath = os.path.join(sys.prefix, "Scripts", "evennia_launcher.py")
|
2015-02-02 20:54:26 +01:00
|
|
|
with open(batpath, "w") as batfile:
|
2019-12-16 20:31:42 +01:00
|
|
|
batfile.write('@"%s" "%s" %%*' % (sys.executable, scriptpath))
|
2015-03-01 12:43:36 +01:00
|
|
|
return [batpath, os.path.join("bin", "windows", "evennia_launcher.py")]
|
2015-02-02 17:42:24 +01:00
|
|
|
else:
|
2015-02-02 20:14:28 +01:00
|
|
|
return [os.path.join("bin", "unix", "evennia")]
|
2015-01-14 17:21:15 -06:00
|
|
|
|
|
|
|
|
|
2022-11-18 22:07:43 +01:00
|
|
|
def get_all_files():
|
2015-01-16 08:19:33 -06:00
|
|
|
"""
|
2022-11-18 22:07:43 +01:00
|
|
|
By default, the distribution tools ignore all non-python files, such as VERSION.txt.
|
2015-01-16 08:19:33 -06:00
|
|
|
|
|
|
|
|
Make sure we get everything.
|
|
|
|
|
"""
|
2015-01-14 17:21:15 -06:00
|
|
|
file_set = []
|
2019-12-16 20:31:42 +01:00
|
|
|
for root, dirs, files in os.walk("evennia"):
|
2015-01-14 17:21:15 -06:00
|
|
|
for f in files:
|
2019-12-16 20:31:42 +01:00
|
|
|
if ".git" in f.split(os.path.normpath(os.path.join(root, f))):
|
2015-02-02 21:57:06 +01:00
|
|
|
# Prevent the repo from being added.
|
2015-01-16 08:19:33 -06:00
|
|
|
continue
|
2019-12-16 20:31:42 +01:00
|
|
|
file_name = os.path.relpath(os.path.join(root, f), "evennia")
|
2015-01-14 17:21:15 -06:00
|
|
|
file_set.append(file_name)
|
|
|
|
|
return file_set
|
|
|
|
|
|
2017-08-19 23:16:36 +02:00
|
|
|
|
2022-11-18 22:07:43 +01:00
|
|
|
# legacy entrypoint
|
|
|
|
|
setup(scripts=get_evennia_executable(), package_data={"": get_all_files()})
|