Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow figure dash and en dash as year separator in copyright #12738

Conversation

fortysixandtwo
Copy link

@fortysixandtwo fortysixandtwo commented Aug 6, 2024

These are valid characters to denote ranges.

I've came across this as an reproducibility issue here

These are valid characters to denote ranges.
@fortysixandtwo
Copy link
Author

Mh, I don't quite understand why the unicode dash is not preserved in the generated html

it should hit this codepath:


    if copyright_line[5:9].isdigit() and copyright_line[9:10] in {'', ' ', ','}:
        return copyright_line[:5] + replace_year + copyright_line[9:]

but apparently it doesn't.

I'm having some issues running the testsuite, so any help/pointers would be appreciated.

$ python3 -m pytest -k 'test_correct_year'
===================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
libraries: Sphinx-8.1.0+/e6417f64b, docutils-0.21.2
base tmp_path: /tmp/pytest-of-fortysixandtwo/pytest-11
rootdir: /home/fortysixandtwo/git/sphinx
configfile: pyproject.toml
testpaths: tests
collected 2197 items / 2192 deselected / 5 selected                                                                                                                                                                                                           

tests/test_config/test_correct_year.py EEEEE                                                                                                                                                                                                            [100%]

=========================================================================================================================== ERRORS ============================================================================================================================
______________________________________________________________________________________________________ ERROR at setup of test_correct_year[expect_date0] ______________________________________________________________________________________________________

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7d62570>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c8067b60>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
>               mod = import_module(extname)

sphinx/registry.py:449: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """
        sphinxcontrib.applehelp
        ~~~~~~~~~~~~~~~~~~~~~~~
    
        Build Apple help books.
    
        :copyright: Copyright 2007-2019 by the Sphinx team, see README.
        :license: BSD, see LICENSE for details.
    """
    
    import plistlib
    import shlex
    import subprocess
    from os import environ
    from os import path
    from subprocess import CalledProcessError, PIPE, STDOUT
    from typing import Any, Dict
    
    from sphinx.application import Sphinx
    from sphinx.builders.html import StandaloneHTMLBuilder
    from sphinx.errors import SphinxError
    from sphinx.locale import get_translation
    from sphinx.util import logging
>   from sphinx.util import SkipProgressMessage, progress_message
E   ImportError: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py)

/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: ImportError

The above exception was the direct cause of the following exception:

test_params = {'shared_result': None}, app_params = _app_params(args=['html'], kwargs={'srcdir': PosixPath('/tmp/pytest-of-fortysixandtwo/pytest-11/correct-year')}), make_app = <function make_app.<locals>.make at 0x7f72c7939f80>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f72c7ddaa80>

    @pytest.fixture
    def app(
        test_params: dict[str, Any],
        app_params: _app_params,
        make_app: Callable[[], SphinxTestApp],
        shared_result: SharedResult,
    ) -> Iterator[SphinxTestApp]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

sphinx/testing/fixtures.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sphinx/testing/fixtures.py:203: in make
    app_ = SphinxTestApp(*args, **kwargs)
sphinx/testing/util.py:169: in __init__
    super().__init__(
sphinx/application.py:249: in __init__
    self.setup_extension(extension)
sphinx/application.py:429: in setup_extension
    self.registry.load_extension(self, extname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7d62570>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c8067b60>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
                mod = import_module(extname)
            except ImportError as err:
                logger.verbose(__('Original exception:\n') + traceback.format_exc())
>               raise ExtensionError(__('Could not import extension %s') % extname,
                                     err) from err
E               sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))

sphinx/registry.py:452: ExtensionError
______________________________________________________________________________________________________ ERROR at setup of test_correct_year[expect_date1] ______________________________________________________________________________________________________

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c79fce00>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c79fc830>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
>               mod = import_module(extname)

sphinx/registry.py:449: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """
        sphinxcontrib.applehelp
        ~~~~~~~~~~~~~~~~~~~~~~~
    
        Build Apple help books.
    
        :copyright: Copyright 2007-2019 by the Sphinx team, see README.
        :license: BSD, see LICENSE for details.
    """
    
    import plistlib
    import shlex
    import subprocess
    from os import environ
    from os import path
    from subprocess import CalledProcessError, PIPE, STDOUT
    from typing import Any, Dict
    
    from sphinx.application import Sphinx
    from sphinx.builders.html import StandaloneHTMLBuilder
    from sphinx.errors import SphinxError
    from sphinx.locale import get_translation
    from sphinx.util import logging
>   from sphinx.util import SkipProgressMessage, progress_message
E   ImportError: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py)

/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: ImportError

The above exception was the direct cause of the following exception:

test_params = {'shared_result': None}, app_params = _app_params(args=['html'], kwargs={'srcdir': PosixPath('/tmp/pytest-of-fortysixandtwo/pytest-11/correct-year')}), make_app = <function make_app.<locals>.make at 0x7f72c7a22660>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f72c79ffd40>

    @pytest.fixture
    def app(
        test_params: dict[str, Any],
        app_params: _app_params,
        make_app: Callable[[], SphinxTestApp],
        shared_result: SharedResult,
    ) -> Iterator[SphinxTestApp]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

sphinx/testing/fixtures.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sphinx/testing/fixtures.py:203: in make
    app_ = SphinxTestApp(*args, **kwargs)
sphinx/testing/util.py:169: in __init__
    super().__init__(
sphinx/application.py:249: in __init__
    self.setup_extension(extension)
sphinx/application.py:429: in setup_extension
    self.registry.load_extension(self, extname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c79fce00>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c79fc830>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
                mod = import_module(extname)
            except ImportError as err:
                logger.verbose(__('Original exception:\n') + traceback.format_exc())
>               raise ExtensionError(__('Could not import extension %s') % extname,
                                     err) from err
E               sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))

sphinx/registry.py:452: ExtensionError
______________________________________________________________________________________________________ ERROR at setup of test_correct_year[expect_date2] ______________________________________________________________________________________________________

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7881a00>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c78837a0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
>               mod = import_module(extname)

sphinx/registry.py:449: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """
        sphinxcontrib.applehelp
        ~~~~~~~~~~~~~~~~~~~~~~~
    
        Build Apple help books.
    
        :copyright: Copyright 2007-2019 by the Sphinx team, see README.
        :license: BSD, see LICENSE for details.
    """
    
    import plistlib
    import shlex
    import subprocess
    from os import environ
    from os import path
    from subprocess import CalledProcessError, PIPE, STDOUT
    from typing import Any, Dict
    
    from sphinx.application import Sphinx
    from sphinx.builders.html import StandaloneHTMLBuilder
    from sphinx.errors import SphinxError
    from sphinx.locale import get_translation
    from sphinx.util import logging
>   from sphinx.util import SkipProgressMessage, progress_message
E   ImportError: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py)

/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: ImportError

The above exception was the direct cause of the following exception:

test_params = {'shared_result': None}, app_params = _app_params(args=['html'], kwargs={'srcdir': PosixPath('/tmp/pytest-of-fortysixandtwo/pytest-11/correct-year')}), make_app = <function make_app.<locals>.make at 0x7f72c7a23a60>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f72c78838c0>

    @pytest.fixture
    def app(
        test_params: dict[str, Any],
        app_params: _app_params,
        make_app: Callable[[], SphinxTestApp],
        shared_result: SharedResult,
    ) -> Iterator[SphinxTestApp]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

sphinx/testing/fixtures.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sphinx/testing/fixtures.py:203: in make
    app_ = SphinxTestApp(*args, **kwargs)
sphinx/testing/util.py:169: in __init__
    super().__init__(
sphinx/application.py:249: in __init__
    self.setup_extension(extension)
sphinx/application.py:429: in setup_extension
    self.registry.load_extension(self, extname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7881a00>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c78837a0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
                mod = import_module(extname)
            except ImportError as err:
                logger.verbose(__('Original exception:\n') + traceback.format_exc())
>               raise ExtensionError(__('Could not import extension %s') % extname,
                                     err) from err
E               sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))

sphinx/registry.py:452: ExtensionError
______________________________________________________________________________________________________ ERROR at setup of test_correct_year[expect_date3] ______________________________________________________________________________________________________

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c78e4500>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c78e70e0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
>               mod = import_module(extname)

sphinx/registry.py:449: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """
        sphinxcontrib.applehelp
        ~~~~~~~~~~~~~~~~~~~~~~~
    
        Build Apple help books.
    
        :copyright: Copyright 2007-2019 by the Sphinx team, see README.
        :license: BSD, see LICENSE for details.
    """
    
    import plistlib
    import shlex
    import subprocess
    from os import environ
    from os import path
    from subprocess import CalledProcessError, PIPE, STDOUT
    from typing import Any, Dict
    
    from sphinx.application import Sphinx
    from sphinx.builders.html import StandaloneHTMLBuilder
    from sphinx.errors import SphinxError
    from sphinx.locale import get_translation
    from sphinx.util import logging
>   from sphinx.util import SkipProgressMessage, progress_message
E   ImportError: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py)

/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: ImportError

The above exception was the direct cause of the following exception:

test_params = {'shared_result': None}, app_params = _app_params(args=['html'], kwargs={'srcdir': PosixPath('/tmp/pytest-of-fortysixandtwo/pytest-11/correct-year')}), make_app = <function make_app.<locals>.make at 0x7f72c78ecd60>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f72c78e6600>

    @pytest.fixture
    def app(
        test_params: dict[str, Any],
        app_params: _app_params,
        make_app: Callable[[], SphinxTestApp],
        shared_result: SharedResult,
    ) -> Iterator[SphinxTestApp]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

sphinx/testing/fixtures.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sphinx/testing/fixtures.py:203: in make
    app_ = SphinxTestApp(*args, **kwargs)
sphinx/testing/util.py:169: in __init__
    super().__init__(
sphinx/application.py:249: in __init__
    self.setup_extension(extension)
sphinx/application.py:429: in setup_extension
    self.registry.load_extension(self, extname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c78e4500>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c78e70e0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
                mod = import_module(extname)
            except ImportError as err:
                logger.verbose(__('Original exception:\n') + traceback.format_exc())
>               raise ExtensionError(__('Could not import extension %s') % extname,
                                     err) from err
E               sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))

sphinx/registry.py:452: ExtensionError
______________________________________________________________________________________________________ ERROR at setup of test_correct_year[expect_date4] ______________________________________________________________________________________________________

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7883b90>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c7883ef0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
>               mod = import_module(extname)

sphinx/registry.py:449: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    """
        sphinxcontrib.applehelp
        ~~~~~~~~~~~~~~~~~~~~~~~
    
        Build Apple help books.
    
        :copyright: Copyright 2007-2019 by the Sphinx team, see README.
        :license: BSD, see LICENSE for details.
    """
    
    import plistlib
    import shlex
    import subprocess
    from os import environ
    from os import path
    from subprocess import CalledProcessError, PIPE, STDOUT
    from typing import Any, Dict
    
    from sphinx.application import Sphinx
    from sphinx.builders.html import StandaloneHTMLBuilder
    from sphinx.errors import SphinxError
    from sphinx.locale import get_translation
    from sphinx.util import logging
>   from sphinx.util import SkipProgressMessage, progress_message
E   ImportError: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py)

/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: ImportError

The above exception was the direct cause of the following exception:

test_params = {'shared_result': None}, app_params = _app_params(args=['html'], kwargs={'srcdir': PosixPath('/tmp/pytest-of-fortysixandtwo/pytest-11/correct-year')}), make_app = <function make_app.<locals>.make at 0x7f72c7a23ec0>
shared_result = <sphinx.testing.fixtures.SharedResult object at 0x7f72c7883a40>

    @pytest.fixture
    def app(
        test_params: dict[str, Any],
        app_params: _app_params,
        make_app: Callable[[], SphinxTestApp],
        shared_result: SharedResult,
    ) -> Iterator[SphinxTestApp]:
        """
        Provides the 'sphinx.application.Sphinx' object
        """
        args, kwargs = app_params
>       app_ = make_app(*args, **kwargs)

sphinx/testing/fixtures.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sphinx/testing/fixtures.py:203: in make
    app_ = SphinxTestApp(*args, **kwargs)
sphinx/testing/util.py:169: in __init__
    super().__init__(
sphinx/application.py:249: in __init__
    self.setup_extension(extension)
sphinx/application.py:429: in setup_extension
    self.registry.load_extension(self, extname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sphinx.registry.SphinxComponentRegistry object at 0x7f72c7883b90>, app = <[AttributeError("'SphinxTestApp' object has no attribute 'builder'") raised in repr()] SphinxTestApp object at 0x7f72c7883ef0>, extname = 'sphinxcontrib.applehelp'

    def load_extension(self, app: Sphinx, extname: str) -> None:
        """Load a Sphinx extension."""
        if extname in app.extensions:  # already loaded
            return
        if extname in EXTENSION_BLACKLIST:
            logger.warning(__('the extension %r was already merged with Sphinx since '
                              'version %s; this extension is ignored.'),
                           extname, EXTENSION_BLACKLIST[extname])
            return
    
        # update loading context
        prefix = __('while setting up extension %s:') % extname
        with prefixed_warnings(prefix):
            try:
                mod = import_module(extname)
            except ImportError as err:
                logger.verbose(__('Original exception:\n') + traceback.format_exc())
>               raise ExtensionError(__('Could not import extension %s') % extname,
                                     err) from err
E               sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))

sphinx/registry.py:452: ExtensionError
=================================================================================================================== short test summary info ===================================================================================================================
ERROR tests/test_config/test_correct_year.py::test_correct_year[expect_date0] - sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))
ERROR tests/test_config/test_correct_year.py::test_correct_year[expect_date1] - sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))
ERROR tests/test_config/test_correct_year.py::test_correct_year[expect_date2] - sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))
ERROR tests/test_config/test_correct_year.py::test_correct_year[expect_date3] - sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))
ERROR tests/test_config/test_correct_year.py::test_correct_year[expect_date4] - sphinx.errors.ExtensionError: Could not import extension sphinxcontrib.applehelp (exception: cannot import name 'SkipProgressMessage' from 'sphinx.util' (/home/fortysixandtwo/git/sphinx/sphinx/util/__init__.py))
============================================================================================================= 2192 deselected, 5 errors in 1.06s ==============================================================================================================

but I can import sphinxcontrib.applehelp just fine in the interactive interpreter:

> $ python3                                                                                                                                                                                                                                                   
Python 3.12.4 (main, Jul 15 2024, 12:17:32) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.applehelp
/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: RemovedInSphinx80Warning: The alias 'sphinx.util.SkipProgressMessage' is deprecated, use 'sphinx.util.display.SkipProgressMessage' instead. Check CHANGES for Sphinx API modifications.
  from sphinx.util import SkipProgressMessage, progress_message
/usr/lib/python3/dist-packages/sphinxcontrib/applehelp/__init__.py:24: RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.
  from sphinx.util import SkipProgressMessage, progress_message
>>> 

@jayaddison
Copy link
Contributor

Hi @fortysixandtwo! I attempted something similar recently (except without figure-dash support) in #12450 -- although discarded that after learning that some projects are intentonally using non-hyphen dashes for a workaround that it provides: it disables the copyright-year substitution on their copyright notices.

I don't think it'd be great to merge this if we know it's going to break their workflows -- but I do also agree in theory that it'd be nice to support other forms of year-range separator.

Most of the notes and ideas I've taken about this are in #12451 -- I'd warn that there's a lot of me rambling to myself as I worked through the details, and the conclusions that I did reach have not yet resulted in any merged pull requests. If you have any time to add commentary / suggestions I'd be grateful - it's good to know that someone else cares about and is reading into this.

I don't want to be obstructive, and other maintainers could overrule me, but I do think that this change (although well-intentioned) would cause problems for some folks.

@AA-Turner
Copy link
Member

Closing per @jayaddison's rationale.

A

@AA-Turner AA-Turner closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants