-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·152 lines (118 loc) · 4.09 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
#!/usr/bin/env python2.7
import os.path
import subprocess
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.core import Command
from distutils.command.build import build as orig_build_cmd
class test_cmd(Command):
description = 'run unit tests'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import unittest
unittest.main(argv=['-v', 'discover'])
class readme_cmd(Command):
description = 'generate HTML readme from README.rst'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from path import path
from docutils.core import publish_file
basedir = path(__file__).dirname()
rst_path = basedir.joinpath('README.rst')
html_path = basedir.joinpath('README.html')
if html_path.isfile() and html_path.mtime >= rst_path.mtime:
return
with open(rst_path, 'r') as src:
with open(html_path, 'w') as dst:
publish_file(source=src, destination=dst, writer_name='html')
try:
reload_tab_cmd = 'reload-tab'
subprocess.check_call([reload_tab_cmd, html_path])
except OSError, e:
print 'Error calling %s: %s' % (reload_tab_cmd, e)
class build_aux_cmd(Command):
description = 'call make in vmreflect/lib-win32/socketclient'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from path import path
subprocess.check_call(
['make'], cwd=(path(__file__).dirname()
.joinpath('vmreflect/lib-win32/socketclient')))
class my_build_cmd(orig_build_cmd):
pass
my_build_cmd.sub_commands.extend([
('build_aux', lambda x: True),
('readme', lambda x: True),
])
with open(os.path.join(os.path.dirname(__file__), 'README.rst'),
'r') as readme:
# The image in README.rst causes it to show up as plain text on pypi.
# These magic comments omit that part of the long_description.
src_lines = []
copy = True
for line in readme.readlines():
if line.startswith(".. comment: begin omit from long_description"):
copy=False
if copy:
src_lines.append(line)
if line.startswith(".. comment: end omit from long_description"):
copy=True
long_description = ''.join(src_lines)
setup(cmdclass={'test': test_cmd,
'readme': readme_cmd,
'build': my_build_cmd,
'build_aux': build_aux_cmd,
},
name='vmreflect',
version=__import__('vmreflect').__version__,
author='Andrew Neitsch',
author_email='[email protected]',
url='https://www.github.com/andrewdotn/vmreflect',
# max 200 characters
description="automatically tunnel localhost servers on your Mac into VMware Fusion Windows guests",
keywords=['proxy', 'reflector', 'virtual machine', 'firewall',
'port forwarding'],
# PyPI home page content in reStructuredText format
long_description=long_description,
classifiers = [
# https://pypi.python.org/pypi?:action=list_classifiers
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: BSD License',
'Environment :: Console',
'Environment :: MacOS X',
'Operating System :: MacOS :: MacOS X',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2.7',
'Topic :: System :: Networking',
],
install_requires = [
'TcpProxyReflector >=0.1.3',
'path.py >=3.0.1',
'pefile >= 1.2.10',
],
packages=[
'vmreflect',
'vmreflect.tests',
],
scripts=['scripts/vmreflect'],
package_data={
'vmreflect': [
'lib-win32/*.zip',
'lib-win32/socketclient/socketclient.exe',
],
},
)