Skip to content

Commit 312d76c

Browse files
committed
Update _astropy_init to latest version in astropy package-template (#608)
1 parent 85a0257 commit 312d76c

File tree

1 file changed

+5
-44
lines changed

1 file changed

+5
-44
lines changed

skypy/_astropy_init.py

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,13 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2+
import os
23

3-
__all__ = ['__version__']
4-
5-
# this indicates whether or not we are in the package's setup.py
6-
try:
7-
_ASTROPY_SETUP_
8-
except NameError:
9-
import builtins
10-
builtins._ASTROPY_SETUP_ = False
4+
__all__ = ['__version__', 'test']
115

126
try:
137
from .version import version as __version__
148
except ImportError:
159
__version__ = ''
1610

17-
18-
if not _ASTROPY_SETUP_: # noqa
19-
import os
20-
from warnings import warn
21-
from astropy.config.configuration import (
22-
update_default_config,
23-
ConfigurationDefaultMissingError,
24-
ConfigurationDefaultMissingWarning)
25-
26-
# Create the test function for self test
27-
from astropy.tests.runner import TestRunner
28-
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
29-
test.__test__ = False
30-
__all__ += ['test']
31-
32-
# add these here so we only need to cleanup the namespace at the end
33-
config_dir = None
34-
35-
if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False):
36-
config_dir = os.path.dirname(__file__)
37-
config_template = os.path.join(config_dir, __package__ + ".cfg")
38-
if os.path.isfile(config_template):
39-
try:
40-
update_default_config(
41-
__package__, config_dir, version=__version__)
42-
except TypeError as orig_error:
43-
try:
44-
update_default_config(__package__, config_dir)
45-
except ConfigurationDefaultMissingError as e:
46-
wmsg = (e.args[0] +
47-
" Cannot install default profile. If you are "
48-
"importing from source, this is expected.")
49-
warn(ConfigurationDefaultMissingWarning(wmsg))
50-
del e
51-
except Exception:
52-
raise orig_error
11+
# Create the test function for self test
12+
from astropy.tests.runner import TestRunner
13+
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))

0 commit comments

Comments
 (0)