-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
123 lines (101 loc) · 4.31 KB
/
setup.py
File metadata and controls
123 lines (101 loc) · 4.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
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
#!/usr/bin/env python
import os
import re
import subprocess
import sys
import platform
import warnings
from setuptools import setup
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
# `distutils` was removed in Python 3.12. Fall back to `packaging.version`,
# which is available with any modern setuptools install.
try:
from packaging.version import Version as _Version
except ImportError: # pragma: no cover - extremely old environment
from distutils.version import LooseVersion as _Version # type: ignore
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
here = os.path.abspath(os.path.dirname(__file__))
def read_requirements_macos():
with open('requirements.txt') as fp:
return [row.strip() for row in fp if row.strip()]
class MakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class MakeBuild(build_ext):
def run(self):
try:
out = subprocess.check_output(['make', '--version'])
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))
cmake_version = _Version(re.search(r'GNU Make\s*([\d.]+)', out.decode()).group(1))
if cmake_version < _Version('4.2.1'):
raise RuntimeError("GNU Make >= 4.2.1 is required")
for ext in self.extensions:
self.build_extension(ext)
def build_extension(self, ext):
export_path = os.path.join('mapilio_kit', 'base', 'bin')
if not os.path.exists(export_path):
os.makedirs(export_path)
subprocess.run(['make',
'-C',
os.path.join('extras', os.path.basename(ext.name)),
'-j'
]
)
subprocess.run(['cp', os.path.join('extras', 'max2sphere-batch/MAX2spherebatch'),
export_path])
def install_maxextractor():
subprocess.run(['bash', 'max_extractor_install.sh'])
def read_requirements():
install_maxextractor()
with open('requirements.txt') as fp:
return [row.strip() for row in fp if row.strip()]
def win_read_requirements():
with open('requirements.txt') as fp:
return [row.strip() for row in fp if row.strip()]
about = {}
with open(os.path.join(here, 'mapilio_kit','components', 'version.py'), 'r') as f:
exec(f.read(), about)
if os.name == 'nt' or 'darwin':
requires = win_read_requirements()
ext_modules = []
cmdclass = {}
else:
requires = read_requirements()
ext_modules = [MakeExtension('extras/max2sphere-batch')]
cmdclass = dict(build_ext=MakeBuild)
setup(name='mapilio-kit',
version=about['VERSION'],
description='MAPILIO Image/Video Upload and Pipeline',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
url='https://github.com/mapilio/mapilio-kit-v2',
author='Mapilio',
license='MIT License',
python_requires=">=3.8",
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Multimedia :: Graphics",
"Topic :: Scientific/Engineering :: GIS",
],
ext_modules=ext_modules,
cmdclass=cmdclass,
packages=['mapilio_kit', 'mapilio_kit.base', 'mapilio_kit.components','mapilio_kit.components.auth','mapilio_kit.components.geotagging','mapilio_kit.components.ipc','mapilio_kit.components.metadata','mapilio_kit.components.upload','mapilio_kit.components.blending','mapilio_kit.components.logs','mapilio_kit.components.processing','mapilio_kit.components.utilities'],
entry_points='''
[console_scripts]
mapilio_kit=mapilio_kit.__main__:main
''',
install_requires=requires
)