Skip to content

Commit 3344036

Browse files
authored
Merge pull request #118 from pllim/relictify-relic
MNT: Replace relic with setuptools_scm
2 parents 1885423 + 300421d commit 3344036

File tree

8 files changed

+39
-81
lines changed

8 files changed

+39
-81
lines changed

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# RELIC files
2-
RELIC-INFO
3-
41
# Compiled files
52
*.py[co]
63
*.a

.gitmodules

-3
This file was deleted.

MANIFEST.in

-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ include README.rst
22
include LICENSE.md
33
include CITATION
44

5-
include RELIC-INFO
6-
75
recursive-include doc *
8-
recursive-include relic *
9-
prune relic/.git
10-
prune relic/tests
116

127
prune build
138
prune doc/build

doc/source/conf.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
#
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
13-
14-
import sys, os
13+
from pkg_resources import get_distribution
1514

1615
# work around that annoying warning that pysynphot always prints
1716
import warnings
18-
with warnings.catch_warnings() :
17+
with warnings.catch_warnings():
1918
warnings.simplefilter('ignore')
2019
import pysynphot
2120

@@ -50,16 +49,16 @@
5049

5150
# General information about the project.
5251
project = u'pysynphot'
53-
copyright = u'2016, STScI'
52+
copyright = u'2019, STScI'
5453

5554
# The version info for the project you're documenting, acts as replacement for
5655
# |version| and |release|, also used in various other places throughout the
5756
# built documents.
5857
#
59-
# The short X.Y version.
60-
version = pysynphot.__version__
6158
# The full version, including alpha/beta/rc tags.
62-
release = version.replace('.dev', '')
59+
release = get_distribution('pysynphot').version
60+
# The short X.Y version.
61+
version = '.'.join(release.split('.')[:2])
6362

6463
# The language for content autogenerated by Sphinx. Refer to documentation
6564
# for a list of supported languages.

pysynphot/__init__.py

+30-34
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,48 @@
55
"""
66
from __future__ import absolute_import
77

8-
# For backwards compatibility
8+
from pkg_resources import get_distribution, DistributionNotFound
9+
910
try:
10-
from .version import *
11-
except ImportError:
12-
__svn_version__ = 'none'
13-
__full_svn_info__ = 'none'
14-
__svn_revision__ = __svn_version__
15-
__svn_full_info__ = __full_svn_info__
16-
else:
17-
__svn_version__ = __version_commit__
18-
__full_svn_info__ = '-'.join(
19-
[__version__,
20-
__version_post__,
21-
__version_commit__,]) + ' ({0})'.format(__version_date__)
22-
__svn_revision__ = __svn_version__
23-
__svn_full_info__ = __full_svn_info__
11+
__version__ = get_distribution(__name__).version
12+
except DistributionNotFound:
13+
# package is not installed
14+
__version__ = 'unknown'
2415

16+
# For backwards compatibility
17+
__svn_version__ = 'none'
18+
__full_svn_info__ = 'none'
19+
__svn_revision__ = __svn_version__
20+
__svn_full_info__ = __full_svn_info__
2521

2622
# UI:
2723
# AnalyticSpectra:
28-
from .spectrum import BlackBody, GaussianSource, FlatSpectrum
29-
from .spectrum import Powerlaw as PowerLaw
24+
from .spectrum import BlackBody, GaussianSource, FlatSpectrum # noqa
25+
from .spectrum import Powerlaw as PowerLaw # noqa
3026
# Tabular Spectra
31-
from .spectrum import FileSourceSpectrum as FileSpectrum
32-
from .spectrum import ArraySourceSpectrum as ArraySpectrum
33-
from .catalog import Icat
27+
from .spectrum import FileSourceSpectrum as FileSpectrum # noqa
28+
from .spectrum import ArraySourceSpectrum as ArraySpectrum # noqa
29+
from .catalog import Icat # noqa
3430
# Analytic Spectral Elements
35-
from .spectrum import Box, UniformTransmission
31+
from .spectrum import Box, UniformTransmission # noqa
3632
# Tabular Spectral Elements
37-
from .spectrum import FileSpectralElement as FileBandpass
38-
from .spectrum import ArraySpectralElement as ArrayBandpass
33+
from .spectrum import FileSpectralElement as FileBandpass # noqa
34+
from .spectrum import ArraySpectralElement as ArrayBandpass # noqa
3935
# Complicated spectral elements
40-
from .obsbandpass import ObsBandpass
41-
from .reddening import Extinction
36+
from .obsbandpass import ObsBandpass # noqa
37+
from .reddening import Extinction # noqa
4238
# Observations
43-
from .observation import Observation
39+
from .observation import Observation # noqa
4440
# Other constructs
45-
from .observationmode import ObservationMode as Obsmode
46-
from numpy import arange as Waveset
41+
from .observationmode import ObservationMode as Obsmode # noqa
42+
from numpy import arange as Waveset # noqa
4743
# Get Vega
48-
from .spectrum import Vega
44+
from .spectrum import Vega # noqa
4945
# Get cache
50-
from . import Cache
46+
from . import Cache # noqa
5147
# Permit resetting refdata
52-
from .refs import setref, showref, getref
48+
from .refs import setref, showref, getref # noqa
5349
# Others
54-
from .locations import get_data_filename
55-
from .spparser import parse_spec
56-
from . import tables
50+
from .locations import get_data_filename # noqa
51+
from .spparser import parse_spec # noqa
52+
from . import tables # noqa

relic

-1
This file was deleted.

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool:pytest]
22
minversion = 3.0
3-
norecursedirs = build doc/build commissioning planning relic pysynphot/src
3+
norecursedirs = build doc/build commissioning planning pysynphot/src
44
addopts = -p no:warnings
55

66
[flake8]

setup.py

+2-27
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,11 @@
11
#!/usr/bin/env python
2-
import os
3-
import pkgutil
4-
import sys
52
from glob import glob
63
from numpy import get_include as np_include
74
from setuptools import setup, Extension
8-
from subprocess import check_call, CalledProcessError
9-
10-
11-
if not pkgutil.find_loader('relic'):
12-
relic_local = os.path.exists('relic')
13-
relic_submodule = (relic_local and
14-
os.path.exists('.gitmodules') and
15-
not os.listdir('relic'))
16-
try:
17-
if relic_submodule:
18-
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
19-
elif not relic_local:
20-
check_call(['git', 'clone', 'https://github.com/jhunkeler/relic.git'])
21-
22-
sys.path.insert(1, 'relic')
23-
except CalledProcessError as e:
24-
print(e)
25-
exit(1)
26-
27-
import relic.release # noqa
28-
29-
version = relic.release.get_info()
30-
relic.release.write_template(version, 'pysynphot')
315

326
setup(
337
name='pysynphot',
34-
version=version.pep386,
8+
use_scm_version=True,
359
author=('Vicki Laidler, Pey Lian Lim, Matt Davis, Robert Jedrzejewski, '
3610
'Ivo Busko'),
3711
author_email='[email protected]',
@@ -46,6 +20,7 @@
4620
'Topic :: Scientific/Engineering :: Astronomy',
4721
'Topic :: Software Development :: Libraries :: Python Modules',
4822
],
23+
setup_requires=['setuptools_scm'],
4924
install_requires=[
5025
'astropy',
5126
'numpy',

0 commit comments

Comments
 (0)