Skip to content

Commit d31daa5

Browse files
authored
Merge pull request #51 from pllim/rm-distutils
MNT: Replace distutils with packaging
2 parents e725b6e + 89729db commit d31daa5

File tree

6 files changed

+12
-32
lines changed

6 files changed

+12
-32
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Changes in sphinx-astropy
44
1.7 (unreleased)
55
----------------
66

7+
- Removed dependency on ``distutils``. As a result, ``packaging`` is now
8+
a dependency. [#51]
9+
710
1.6 (2021-09-22)
811
----------------
912

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ zip_safe = False
1919
packages = find:
2020
python_requires = >=3.7
2121
install_requires =
22+
packaging
2223
sphinx>=1.7
2324
astropy-sphinx-theme
2425
numpydoc

sphinx_astropy/conf/v1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from os import path
1717

1818
import sphinx
19-
from distutils.version import LooseVersion
19+
from packaging.version import Version
2020

2121
try:
2222
import astropy
@@ -41,8 +41,8 @@
4141

4242

4343
def check_sphinx_version(expected_version):
44-
sphinx_version = LooseVersion(sphinx.__version__)
45-
expected_version = LooseVersion(expected_version)
44+
sphinx_version = Version(sphinx.__version__)
45+
expected_version = Version(expected_version)
4646
if sphinx_version < expected_version:
4747
raise RuntimeError(
4848
"At least Sphinx version {0} is required to build this "

sphinx_astropy/ext/intersphinx_toggle.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
1010
This is used e.g. by astropy-helpers when using the build_docs command.
1111
"""
12-
13-
from __future__ import print_function
14-
15-
from distutils.version import LooseVersion
12+
from packaging.version import Version
1613

1714
from sphinx import __version__
1815

19-
SPHINX_LT_18 = LooseVersion(__version__) < LooseVersion('1.8')
16+
SPHINX_LT_18 = Version(__version__) < Version('1.8')
2017

2118

2219
def disable_intersphinx(app, config=None):

sphinx_astropy/ext/missing_static.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
The purpose of this extension is to give a clear warning if sphinx is expecting
55
a static directory to be present but it isn't.
66
"""
7-
8-
from __future__ import print_function
9-
107
import os
11-
from distutils.version import LooseVersion
8+
from packaging.version import Version
129

1310
from sphinx import __version__
1411

15-
SPHINX_LT_18 = LooseVersion(__version__) < LooseVersion('1.8')
12+
SPHINX_LT_18 = Version(__version__) < Version('1.8')
1613

1714

1815
WARNING_TEMPLATE = """

sphinx_astropy/tests/test_conf.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
from distutils.version import LooseVersion
2-
3-
from sphinx import __version__
4-
5-
SPHINX_LT_17 = LooseVersion(__version__) < LooseVersion('1.7')
6-
7-
if SPHINX_LT_17:
8-
9-
from sphinx import build_main as build_main_original
10-
11-
# As of Sphinx 1.7, the first argument is now no longer ignored, so we
12-
# construct a wrapper for older versions.
13-
14-
def build_main(argv=None):
15-
argv.insert(0, 'sphinx-build')
16-
return build_main_original(argv=argv)
17-
18-
else:
19-
from sphinx.cmd.build import build_main
1+
from sphinx.cmd.build import build_main
202

213
BASIC_CONF = """
224
from sphinx_astropy.conf import *

0 commit comments

Comments
 (0)