forked from kdschlosser/pyWinVirtualDesktop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
105 lines (93 loc) · 2.48 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
# -*- coding: utf-8 -*-
from __future__ import print_function
import msvc
from setuptools import setup, find_packages, Extension
import os
import sys
print(msvc.environment)
def_template = '''\
LIBRARY DLLMAIN
EXPORTS
{exports}
'''
def_file = os.path.join('src', 'dllmain.def')
if sys.version_info[0] >= 3:
exports = 'PyInit_libWinVirtualDesktop'
else:
exports = 'initlibWinVirtualDesktop'
with open(def_file, 'w') as f:
f.write(def_template.format(exports=exports))
if sys.maxsize > 2**32:
macro = ('WIN64', 1)
else:
macro = ('WIN32', 1)
libWinVirtualDesktop = Extension(
'libWinVirtualDesktop',
sources=[
os.path.join('src', 'dllmain.cpp'),
os.path.join('src', 'stdafx.cpp'),
],
include_dirs=['src'] + msvc.environment.python.includes,
library_dirs=(
msvc.environment.windows_sdk.lib +
msvc.environment.python.libraries
),
extra_link_args=[
'/def:"' + def_file + '"'
],
extra_compile_args=[
'/Gy',
'/O2',
'/Gd',
'/Oy',
'/Oi',
'/fp:precise',
'/Zc:wchar_t',
'/Zc:forScope',
'/EHsc',
],
define_macros=[
macro,
('NDEBUG', 1),
('_WINDOWS', 1),
('_USRDLL', 1),
('PY_SSIZE_T_CLEAN', 1),
('LIBWINVIRTUALDESKTOP_EXPORTS', 1),
],
libraries=[
'Rpcrt4',
'Ole32',
'User32',
msvc.environment.python.dependency[:-4]
]
)
setup(
name='pyWinVirtualDesktop',
author='Kevin Schlosser',
author_email='[email protected]',
version='0.1.0',
zip_safe=False,
ext_modules=[libWinVirtualDesktop],
dependency_links=[
'https://github.com/kdschlosser/comtypes/tarball'
'/zip_safe#egg=comtypes'
],
url='https://github.com/kdschlosser/pyWinVirtualDesktop',
install_requires=['six', 'comtypes'],
packages=['pyWinVirtualDesktop'] + find_packages('pyWinVirtualDesktop'),
package_dir=dict(
pyWinVirtualDesktop='pyWinVirtualDesktop',
),
description='Windows 10 Virtual Desktop Management.',
long_description='Windows 10 Virtual Desktop Management.',
keywords=['virtual desktop', 'windows 10'],
classifiers=[
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
(
"License :: OSI Approved :: "
"GNU General Public License v3 or later (GPLv3+)"
),
],
)