-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
84 lines (75 loc) · 2.31 KB
/
setup.py
File metadata and controls
84 lines (75 loc) · 2.31 KB
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
"""Setup entry point."""
import os
import platform
from setuptools import setup, find_packages
# to get the long description
with open('README.md') as f:
long_description = f.read()
# parse the reqs/deps files
with open('requirements.txt') as f:
install_requirements = f.read().split("\n")
with open('requirements_dev.txt') as f:
test_requirements = f.read().split("\n")
with open('dependencies.txt') as f:
dependency_requirements = f.read().split("\n")
# prepare
packages_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"packages")
src_dir = os.path.join(
packages_dir,
"src")
print("packages_dir = {}\nsrc_dir = {}".format(
packages_dir, src_dir))
# compile and install sources
# NOTE: cannot use setup.py for these since cannot pass -prefix and -exec-prefix
sources = [
("sbc", "1.2.0"),
("dbus-python", "1.2.8")
]
for lib in sources:
print("Installing {}-{} library from source ...".format(
lib[0], lib[1]))
os.system(
"cd '{srcdir}'; "
"tar xf {libname}-{libver}.tar.gz; "
"cd {libname}-{libver}; "
"./configure -prefix=$VIRTUAL_ENV -exec-prefix=$VIRTUAL_ENV >/dev/null; "
"make >/dev/null; "
"sudo make install >/dev/null; "
"if [ -f setup.py ]; then python setup.py install; fi; ".format(
srcdir=src_dir,
libname=lib[0],
libver=lib[1]))
# go-go
setup(
name="pytooth",
version="1.0.0",
description="A Linux Bluez5-based implementation of A2DP and HFP.",
long_description=long_description,
author="Anthony Ishkan",
author_email="anthony.ishkan@gmail.com",
url="https://bitbucket.org/ishkanan/pytooth",
packages=find_packages(".", include=["*"]),
package_dir={"": "."},
package_data={
"": ["*.txt", "*.rst", "*.md"]
},
tests_require=test_requirements,
install_requires=install_requirements,
dependency_links=dependency_requirements,
entry_points={
"console_scripts": [
"pytooth-test = pytooth.tests.main:main",
],
},
zip_safe=False
)
# clean up working folders
print("Cleaning up source folders ...")
for lib in sources:
os.system(
"sudo rm -Rf '{srcdir}/{libname}-{libver}/'; ".format(
srcdir=src_dir,
libname=lib[0],
libver=lib[1]))