-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
129 lines (117 loc) · 4.3 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
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2021 shmilee
import os
from setuptools import setup, find_packages
from setuptools.command.sdist import sdist
from setuptools.command.build_py import build_py
here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, 'src', '__about__.py'), encoding='utf-8') as f:
about['__file__'] = f.name
exec(f.read(), about)
data_dir = os.path.basename(about['__data_path__'])
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = '\n' + f.read()
packages = ['gdpy3']
subpackages = find_packages(where='src', exclude=('*tests',))
packages.extend(['gdpy3.%s' % p for p in subpackages])
_git_versionstr_file = about['_git_versionstr_file']
_git_versionstr_write = about['_git_versionstr_write']
class my_sdist(sdist):
def make_release_tree(self, base_dir, files):
if not self.dry_run:
target_dir = os.path.join(base_dir, 'src', data_dir)
self.mkpath(target_dir)
target_file = os.path.join(target_dir, _git_versionstr_file)
print('creating git version file', target_file)
_git_versionstr_write(target_file)
super(my_sdist, self).make_release_tree(base_dir, files)
class my_build_py(build_py):
def run(self):
# for idx, attr in enumerate(dir(self)):
# print('---', idx, attr, ':', getattr(self, attr))
if not self.dry_run:
# print('---', os.listdir(os.path.join('src', data_dir)))
source_file = os.path.join('src', data_dir, _git_versionstr_file)
target_dir = os.path.join(self.build_lib, 'gdpy3', data_dir)
self.mkpath(target_dir)
target_file = os.path.join(target_dir, _git_versionstr_file)
if os.path.isfile(source_file):
self.copy_file(source_file, target_file)
else:
print('creating git version file', target_file)
_git_versionstr_write(target_file)
super(my_build_py, self).run()
setup(
name='gdpy3',
version=about['__version__'],
description=about['__description__'],
long_description=long_description,
long_description_content_type='text/x-rst',
author=about['__author__'],
author_email=about['__email__'],
url=about['__url__'],
license=about['__license__'],
keywords='GTC, matplotlib',
package_dir={'gdpy3': 'src'},
packages=packages,
platforms=[
'Linux',
'MacOS X',
'Windows',
],
classifiers=[
'Development Status :: %s' % about['__status__'],
'Environment :: Console',
'Environment :: Plugins',
'Environment :: X11 Applications',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: OS Independent',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Visualization'
],
install_requires=[
'numpy>=1.10.0',
'scipy>=0.14.0',
'matplotlib>=2.0.0',
],
extras_require={
'data': ['h5py>=2.6.0', 'paramiko>=2.0.0'],
'tkui': ['screeninfo>=0.4.1'],
'nbui': ['ipython[notebook]', 'ipywidgets'],
'imcat': ['pillow>=4.0.0', 'libsixel-python>=0.5.0'],
'autocomplete': ['argcomplete>=2.0.0'],
},
cmdclass={
'sdist': my_sdist,
'build_py': my_build_py,
},
package_data={
'gdpy3': ['%s/%s' % (data_dir, f) for f in [
'*-stylelib/gdpy3-*.*style',
'*-stylelib/readme.txt',
'icon/*',
'ipynb_scrollbar/*'
]],
},
data_files=[],
entry_points={
'console_scripts': [
'gdpy3 = gdpy3.__main__:entry_iface',
'gdpy3-cli = gdpy3.cli:cli_script',
],
'gui_scripts': [
'gdpy3-gui = gdpy3.GUI:gui_script',
],
},
)