-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
65 lines (50 loc) · 1.79 KB
/
setup.py
File metadata and controls
65 lines (50 loc) · 1.79 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
"""Install ExtensysPlots.
This will copy the *.mplstyle files into the right directory.
"""
import atexit
import glob
import os
import shutil
import matplotlib
import matplotlib.pyplot as plt
from setuptools import setup
from setuptools.command.install import install
package_name = 'ExtensysPlots'
# Get the description from README
root = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(root, 'README.md'), 'r', encoding='utf-8') as fb:
long_description = fb.read()
def install_styles():
style_files = glob.glob('styles/**/*.mplstyle', recursive=True)
# find stylelib directory, where the *.mplstyle file goes
mpl_stylelib_dir = os.path.join(matplotlib.get_configdir(), "stylelib")
if not os.path.exists(mpl_stylelib_dir):
os.makedirs(mpl_stylelib_dir)
# copy files over
print(f"Installing styles into {mpl_stylelib_dir}")
for style_file in style_files:
shutil.copy(style_file,
os.path.join(mpl_stylelib_dir, os.path.basename(style_file)))
class PostInstallation(install):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
atexit.register(install_styles)
setup(
name=package_name,
version='1.0.2',
author="Chukwuemeka Michael Ekwonu",
author_email="[email protected]",
description="Matplotlib Extensys style format for scientific publications",
long_description=long_description,
long_description_content_type='text/markdown',
license='MIT',
keywords=[
"extensys-plots",
"matplotlib-style-sheets",
"scientific-publications",
"matplotlib-figures",
"python"],
url="https://github.com/mcekwonu/ExtensysPlots/",
install_requires=['matplotlib', 'pandas', ],
cmdclass={'install': PostInstallation, },
)