forked from piqueserver/piqueserver
/
setup.py
executable file
·165 lines (138 loc) · 5.13 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env python2
from __future__ import print_function
# ### Virtualenv autoload ###
# # Not really sure whether it's worth it... Looks like reinveting virtualenv .
# # Consider making users to load virtualenv on their own.
# from os import path as __p
# venv_dirs = [__p.join(__p.dirname(__p.realpath(__file__)), i) for i in ('venv', '.venv')]
# activated_venv = None
# for venv_dir in venv_dirs:
# try:
# activate_this = __p.join(venv_dir, 'bin', 'activate_this.py')
# execfile(activate_this, dict(__file__=activate_this))
# activated_venv = venv_dir
# except IOError:
# pass
# else:
# break
# print("Using virtualenv %s" % activated_venv)
# import sys
# import os
# if activated_venv is not None:
# sys.argv[0] = __p.join(activated_venv, 'bin', 'python2')
# sys.executable = sys.argv[0]
# os.environ['_'] = sys.argv[0]
# sys.prefix = activated_venv
# sys.exec_prefix = activated_venv
# ### Virtualenv autoload end ###
import sys
import os
PKG_NAME="piqueserver"
PKG_URL="https://github.com/piqueserver/piqueserver"
PKG_DOWNLOAD_URL="https://github.com/piqueserver/piqueserver/archive/0.1.0.zip"
extra_args = sys.argv[2:]
import subprocess
import shutil
from setuptools import setup, find_packages, Extension, dist
from distutils.core import run_setup
try:
import pypandoc
import re
long_description = pypandoc.convert_text(
re.sub(r'[^\x00-\x7F]+',' ',
pypandoc.convert('README.md', 'markdown', format="markdown_github")), 'rst', format="markdown")
except (IOError, ImportError):
long_description = ''
ext_modules = []
names = [
'pyspades.vxl',
'pyspades.bytes',
'pyspades.packet',
'pyspades.contained',
'pyspades.common',
'pyspades.world',
'pyspades.loaders',
'pyspades.mapmaker'
]
static = os.environ.get('STDCPP_STATIC') == "1"
if static:
print("Linking the build statically.")
for name in names:
if static:
extra = {'extra_link_args' : ['-static-libstdc++', '-static-libgcc']}
else:
extra = {}
if name in ['pyspades.vxl', 'pyspades.world', 'pyspades.mapmaker']:
extra["extra_compile_args"] = ['-std=c++11']
if sys.platform == "win32":
# Python aparently redifines hypot to _hypot. This fixes that.
extra["extra_compile_args"].extend(['-include', 'cmath'])
if sys.platform == "win32":
# nobody is using 32-bit in 2017. right? right? please
extra["define_macros"] = [("MS_WIN64", None)]
ext_modules.append(Extension(name, ['./%s.pyx' % name.replace('.', '/')],
language = 'c++', include_dirs=['./pyspades'], **extra))
from distutils.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def run(self):
from Cython.Build import cythonize
self.extensions = cythonize(self.extensions)
_build_ext.run(self)
run_setup(os.path.join(os.getcwd(), "setup.py"), ['build_py'] + extra_args)
setup(
name = PKG_NAME,
packages = [PKG_NAME, '%s.web' % PKG_NAME, '%s.scripts' % PKG_NAME, 'pyspades'],
version = '0.1.0_post1',
description = 'Open-Source server implementation for Ace of Spades',
author = 'Originally MatPow2 and PySnip contributors, now, StackOverflow and piqueserver authors',
author_email = 'nate.shoffner@gmail.com',
maintainer = 'noway421',
maintainer_email = 'noway@2ch.hk',
license = 'GNU General Public License v3',
long_description = long_description,
url = PKG_URL,
download_url = PKG_DOWNLOAD_URL,
keywords = ['ace of spades', 'aos', 'server', 'pyspades', 'pysnip', 'piqueserver'],
classifiers = [
'Intended Audience :: System Administrators',
'Development Status :: 3 - Alpha',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Unix',
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Programming Language :: Cython',
'Programming Language :: Python :: 2 :: Only',
'Framework :: Twisted',
],
platforms = "Darwin, Unix",
setup_requires = ['Cython>=0,<1'], # at least for now when we have to cythonize enet
install_requires = [
'Cython>=0,<1',
'Twisted>=17',
'Jinja2>=2,<3', # status server is part of our 'vanila' package
'Pillow>=3,<5',
'pyenet',
'ipaddr'
],
extras_require = {
'from': ['pygeoip>=0.3.2,<0.4'],
# 'statusserver': ['Jinja2>=2.8,<2.9', 'Pillow>=3.4.2,<3.5'],
'ssh': ['pycrypto>=2.6.1,<2.7', 'cryptography>=2.0.0,<3.0', 'pyasn1>=0.1.9,<0.2']
},
entry_points = {
'console_scripts': [
'%s=%s.run:main' % (PKG_NAME, PKG_NAME)
],
},
package_dir = {
PKG_NAME: 'piqueserver',
'%s.web' % PKG_NAME: 'piqueserver/web',
'%s.scripts' % PKG_NAME: 'piqueserver/scripts',
'pyspades': 'pyspades',
}, # some kind of find_packages?
package_data = {"%s.web" % PKG_NAME: ["templates/status.html"]},
include_package_data=True,
ext_modules = ext_modules,
cmdclass = { 'build_ext': build_ext },
)