-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
88 lines (76 loc) · 2.68 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
#!/usr/bin/env python
from distutils.command.clean import clean as Clean
try:
from skbuild import setup
except ImportError:
from setuptools import setup
import os
class CleanCommand(Clean):
""" Remove generated files """
def run(self):
Clean.run(self)
# remove build_ext inplace generated files
for dirpath, dirnames, filenames in os.walk('videoplayer'):
for filename in filenames:
extension = os.path.splitext(filename)[1]
# bin
if extension in (".so", ".dll", ".pyc"):
print("Remove", filename)
os.unlink(os.path.join(dirpath, filename))
continue
# libs
if extension in ('.c', '.h'):
pyx_file = str.replace(filename, extension, '.pyx')
if os.path.exists(os.path.join(dirpath, pyx_file)):
print("Remove", filename)
os.unlink(os.path.join(dirpath, filename))
# Readme
readme_filepath = os.path.join(os.path.dirname(__file__), "README.md")
try:
import pypandoc
long_description = pypandoc.convert(readme_filepath, 'rst')
except ImportError:
long_description = open(readme_filepath).read()
# Windows
build_cmake_args = list()
if os.getenv("WIN_BUILD"):
build_cmake_args.append('-DUSE_WIN_DEP=ON')
if os.getenv("VCPKG_BUILD"):
build_cmake_args.append('-DUSE_VCPKG=ON')
build_cmake_args.append('-DCMAKE_TOOLCHAIN_FILE={}'.format(os.getenv("VCPKG_TOOLCHAIN")))
# setup
setup(
name='videoplayer',
version='1.1.dev0',
description='VideoPlayer is a C-extension in Python',
long_description=long_description,
long_description_content_type='text/markdown',
author='FoFiX team',
author_email='[email protected]',
license='GPLv2+',
url='https://github.com/fofix/python-videoplayer',
packages=['videoplayer'],
package_data={'videoplayer': ['*.dll']},
zip_safe=False,
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Multimedia',
'Topic :: Software Development :: Libraries',
],
keywords='ogg',
#ext_modules=cythonize(ext, compiler_directives={'language_level': sys.version_info[0]}),
test_suite="tests",
extras_require={
'tests': ['pytest'],
},
cmdclass={
'clean': CleanCommand,
},
# skbuild options
cmake_args=build_cmake_args,
)