forked from jackersson/gstreamer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
82 lines (65 loc) · 2.2 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup for gstreamer-python package
"""
import os
from pathlib import Path
from setuptools import setup
from setuptools.command.build_py import build_py as _build_py
def read(file):
return Path(file).read_text('utf-8').strip()
class build_py(_build_py):
user_options = _build_py.user_options + [
('skip-gst-python', None, "Skip gst-python build"),
]
boolean_options = _build_py.boolean_options + ['skip-gst-python']
def initialize_options(self):
_build_py.initialize_options(self)
self.skip_gst_python = None
def finalize_options(self):
_build_py.finalize_options(self)
def run(self):
import subprocess
def _run_bash_file(bash_file: str):
if os.path.isfile(bash_file):
print("Running ... ", bash_file)
_ = subprocess.run(bash_file, shell=True,
executable="/bin/bash")
else:
print("Not found ", bash_file)
cwd = os.path.dirname(os.path.abspath(__file__))
if not bool(self.skip_gst_python):
_run_bash_file(os.path.join(cwd, 'build-gst-python.sh'))
_run_bash_file(os.path.join(cwd, 'build-3rd-party.sh'))
_build_py.run(self)
install_requires = [
r for r in read('requirements.txt').split('\n') if r]
setup(
name='gstreamer-python',
use_scm_version=True,
setup_requires=['setuptools_scm'],
description="PyGst Utils package",
long_description='\n\n'.join((read('README.md'))),
author="LifeStyleTransfer",
author_email='[email protected]',
url='https://github.com/jackersson/pygst-utils',
packages=[
'gstreamer',
],
include_package_data=True,
install_requires=install_requires,
license="Apache Software License 2.0",
zip_safe=True,
keywords='gstreamer-python',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3.6',
],
cmdclass={
'build_py': build_py,
}
)