-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
83 lines (70 loc) · 2.54 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
import os
from os.path import dirname
from setuptools import setup, convert_path
from setuptools.command.install import install
main_ns = {}
with open(convert_path('able/version.py')) as ver_file:
exec(ver_file.read(), main_ns)
with open(convert_path('README.rst')) as readme_file:
long_description = readme_file.read()
class InstallRecipe(install):
"""Command to install `able` recipe,
copies Java files to distribution `javaclass` directory."""
def run(self):
if 'ANDROIDAPI' not in os.environ:
raise Exception(
'This recipe should not be installed directly, '
'only with the buildozer tool.'
)
# Find Java classes target directory from the environment
distribution_dir = os.environ['PYTHONPATH'].split(':')[-1]
distribution_name = distribution_dir.split('/')[-1]
javaclass_dir = os.path.join(
dirname(dirname(distribution_dir)),
'javaclasses'
)
if not os.path.exists(javaclass_dir):
raise Exception(
'javaclasses directory is not found. '
'Please report issue to: https://github.com/b3b/able/issues'
)
javaclass_dir = os.path.join(javaclass_dir,
distribution_name, 'org', 'able')
if not os.path.exists(javaclass_dir):
os.makedirs(javaclass_dir)
self.distribution.data_files = [
(javaclass_dir, [
'able/src/org/able/BLE.java',
'able/src/org/able/PythonBluetooth.java',
]),
]
install.run(self)
setup(
name='able_recipe',
version=main_ns['__version__'],
packages=['able', 'able.android'],
description='Bluetooth Low Energy for Android',
long_description=long_description,
long_description_content_type='text/x-rst',
author='b3b',
author_email='[email protected]',
install_requires=[],
url='https://github.com/b3b/able',
# https://pypi.org/classifiers/
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Operating System :: Android',
'Topic :: System :: Networking',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='android ble bluetooth kivy',
license='MIT',
zip_safe=False,
cmdclass={
'install': InstallRecipe,
},
)