-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
John Garrett
committed
Sep 16, 2021
1 parent
c552fcf
commit 0f786d2
Showing
3 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
"""Install SciencePlots. | ||
This will copy the *.mplstyle files into the appropriate directory. | ||
This script (setup.py) will copy the matplotlib styles (*.mplstyle) into the | ||
appropriate directory on your computer (OS dependent). | ||
This code is based on a StackOverflow answer: | ||
https://stackoverflow.com/questions/31559225/how-to-ship-or-distribute-a-matplotlib-stylesheet | ||
|
@@ -13,27 +14,17 @@ | |
import shutil | ||
|
||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
from setuptools import setup | ||
from setuptools.command.install import install | ||
|
||
|
||
# Get description from README | ||
root = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(root, 'README.md'), 'r', encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
|
||
def install_styles(): | ||
|
||
# Find all style files | ||
stylefiles = glob.glob('styles/**/*.mplstyle', recursive=True) | ||
|
||
# Find stylelib directory (where the *.mplstyle files go) | ||
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("Installing styles into", mpl_stylelib_dir) | ||
for stylefile in stylefiles: | ||
|
@@ -49,9 +40,14 @@ def __init__(self, *args, **kwargs): | |
atexit.register(install_styles) | ||
|
||
|
||
# Get description from README | ||
root = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(root, 'README.md'), 'r', encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name='SciencePlots', | ||
version='1.0.8', | ||
version='1.0.9', | ||
author="John Garrett", | ||
author_email="[email protected]", | ||
description="Format Matplotlib for scientific plotting", | ||
|