forked from SuperDARN/pydarn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
78 lines (70 loc) · 2.86 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
"""
Copyright 2018 SuperDARN Canada, University of Saskatchewan
setup.py
2018-11-05
To setup pyDARN as a third party library. Include installing need libraries for
running the files.
author:
Marina Schmidt
"""
import sys
from os import path
from setuptools import setup, find_packages
from setuptools.command.install import install, orig
from setuptools.command.develop import develop
from glob import glob
from subprocess import check_call
class update_submodules(develop):
def run(self):
if path.exists('.git'):
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
check_call(['git', 'submodule', 'update', '--recursive', '--remote'])
develop.run(self)
# This class and function overrides the install python
# setup method to add an extra git command in to install
# the submodule
class initialize_submodules(install):
def run(self):
if path.exists('.git'):
print("updating")
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
check_call(['git', 'submodule', 'update', '--recursive', '--remote'])
if self.old_and_unmanageable or self.single_version_externally_managed:
return orig.install.run(self)
caller = sys._getframe(2)
caller_module = caller.f_globals.get('__name__', '')
caller_name = caller.f_code.co_name
if caller_module != 'distutils.dist' or caller_name != 'run_commands':
# We weren't called from the command line or setup(), so we
# should run in b`ackward-compatibility mode to support bdist_*
# commands.
orig.install.run(self)
else:
self.do_egg_install()
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# Setup information
setup(
cmdclass={'install': initialize_submodules, 'develop': update_submodules},
name="pydarn",
version="2.1",
long_description=long_description,
long_description_content_type='text/markdown',
description="Data visualization library for SuperDARN data",
url='https://github.com/SuperDARN/pydarn.git',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'],
python_requires='>=3.6',
data_files=[('pydarn/radar_fov_files',glob('radar_fov_files/**'))],
packages=find_packages(exclude=['docs', 'test']),
author="SuperDARN",
# used to import the logging config file into pydarn.
include_package_data=True,
# setup_requires=['pyyaml', 'numpy', 'matplotlib', 'aacgmv2'],
install_requires=['pyyaml', 'numpy', 'matplotlib', 'aacgmv2',
'pydarnio'],
)