forked from markqvist/Sideband
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
132 lines (115 loc) · 3.94 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import os
import re
import setuptools
from pathlib import Path
with open("README.md", "r") as fh:
long_description = fh.read()
def get_version() -> str:
version_file = os.path.join(
os.path.dirname(__file__), "sbapp", "main.py"
)
version_file_data = open(version_file, "rt", encoding="utf-8").read()
version_regex = r"(?<=^__version__ = ['\"])[^'\"]+(?=['\"]$)"
try:
version = re.findall(version_regex, version_file_data, re.M)[0]
return version
except IndexError:
raise ValueError(f"Unable to find version string in {version_file}.")
def get_variant() -> str:
version_file = os.path.join(
os.path.dirname(__file__), "sbapp", "main.py"
)
version_file_data = open(version_file, "rt", encoding="utf-8").read()
version_regex = r"(?<=^__variant__ = ['\"])[^'\"]+(?=['\"]$)"
try:
version = re.findall(version_regex, version_file_data, re.M)[0]
return version
except IndexError:
return None
__version__ = get_version()
__variant__ = get_variant()
def glob_paths(pattern):
out_files = []
src_path = os.path.join(os.path.dirname(__file__), "kivymd")
for root, dirs, files in os.walk(src_path):
for file in files:
if file.endswith(pattern):
filepath = os.path.join(str(Path(*Path(root).parts[1:])), file)
out_files.append(filepath.split(f"kivymd{os.sep}")[1])
return out_files
def glob_share():
out_files = []
src_path = os.path.join(os.path.dirname(__file__), "sbapp/share")
print(src_path)
for root, dirs, files in os.walk(src_path):
for file in files:
filepath = os.path.join(str(Path(*Path(root).parts[1:])), file)
if not "mirrors/unsigned.io" in str(filepath):
out_files.append(filepath.split(f"sbapp{os.sep}")[1])
return out_files
packages = setuptools.find_packages(
exclude=[
"sbapp.plyer.platforms.android",
"sbapp.kivymd.tools"
"sbapp.kivymd.tools.*"
])
package_data = {
"": [
"assets/*",
"assets/fonts/*",
"assets/geoids/*",
"kivymd/fonts/*",
"kivymd/images/*",
"kivymd/*",
"mapview/icons/*",
*glob_share(),
*glob_paths(".kv")
]
}
variant_str = ""
if __variant__:
variant_str = " "+__variant__
print("Packaging openCom Companion "+__version__+variant_str)
setuptools.setup(
name="occ",
version=__version__,
author="Liberated Embedded Systems",
author_email="[email protected]",
description="LXMF client for Android, Linux and macOS allowing you to communicate with people or LXMF-compatible systems over Reticulum networks using LoRa, Packet Radio, WiFi, I2P, or anything else Reticulum supports.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://git.liberatedsystems.co.uk/jacob.eva/opencom_companion",
packages=packages,
package_data=package_data,
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: Other/Proprietary License",
"Operating System :: OS Independent",
],
data_files = [
('share/applications', ['sbapp/assets/uk.co.liberatedsystems.occ.desktop']),
('share/icons/hicolor/512x512/apps', ['sbapp/assets/uk.co.liberatedsystems.occ.png']),
],
entry_points= {
'console_scripts': [
'sideband=sbapp:main.run',
]
},
install_requires=[
"rns>=0.8.8",
"lxmf>=0.5.8",
"kivy>=2.3.0",
"pillow>=10.2.0",
"qrcode",
"materialyoucolor>=2.0.7",
"ffpyplayer",
"sh",
"numpy<=1.26.4",
"pycodec2;sys.platform!='Windows' and sys.platform!='win32' and sys.platform!='darwin'",
"pyaudio;sys.platform=='linux'",
"pyobjus;sys.platform=='darwin'",
"pyogg;sys.platform=='Windows' and sys.platform!='win32'",
],
python_requires='>=3.7',
)