forked from evennia/evennia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
50 lines (37 loc) · 1.36 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Do custom actions during build/install step.
"""
import os
import sys
from setuptools import setup
OS_WINDOWS = os.name == "nt"
def get_evennia_executable():
"""
Called from build process.
Determine which executable scripts should be added. For Windows,
this means creating a .bat file.
"""
if OS_WINDOWS:
batpath = os.path.join("bin", "windows", "evennia.bat")
scriptpath = os.path.join(sys.prefix, "Scripts", "evennia_launcher.py")
with open(batpath, "w") as batfile:
batfile.write('@"%s" "%s" %%*' % (sys.executable, scriptpath))
return [batpath, os.path.join("bin", "windows", "evennia_launcher.py")]
else:
return [os.path.join("bin", "unix", "evennia")]
def get_all_files():
"""
By default, the distribution tools ignore all non-python files, such as VERSION.txt.
Make sure we get everything.
"""
file_set = []
for root, dirs, files in os.walk("evennia"):
for f in files:
if ".git" in f.split(os.path.normpath(os.path.join(root, f))):
# Prevent the repo from being added.
continue
file_name = os.path.relpath(os.path.join(root, f), "evennia")
file_set.append(file_name)
return file_set
# legacy entrypoint
setup(scripts=get_evennia_executable(), package_data={"": get_all_files()})