sphinx-gitstamp 0.3.3__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-gitstamp
3
+ Version: 0.4.1
4
+ Summary: git timestamp generator for Sphinx
5
+ Author-email: Jared Dillard <jared.dillard@gmail.com>
6
+ Maintainer-email: Jared Dillard <jared.dillard@gmail.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: download, https://pypi.org/project/sphinx-gitstamp/
9
+ Project-URL: source, https://github.com/jdillard/sphinx-gitstamp
10
+ Classifier: Development Status :: 7 - Inactive
11
+ Classifier: Framework :: Sphinx :: Extension
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Documentation :: Sphinx
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ Sphinx Gitstamp Generator Extension
24
+ ===================================
25
+
26
+ A `Sphinx`_ extension that inserts a git datestamp into the context as
27
+ ``gitstamp``, to make it available for template use in HTML versions of
28
+ your Sphinx documentation.
29
+
30
+ |PyPI version| |Downloads| |Code style: Black| |Parallel Safe|
31
+
32
+ .. warning::
33
+
34
+ **This project is deprecated and no longer maintained.**
35
+ Please use `sphinx-last-updated-by-git`_ instead. It provides the same
36
+ functionality plus dependency tracking (included files, images, etc.),
37
+ shallow clone detection, timezone support, and uses Sphinx's standard
38
+ ``last_updated`` template variable, so many themes display it out of
39
+ the box.
40
+
41
+ Migrating to sphinx-last-updated-by-git
42
+ ---------------------------------------
43
+
44
+ 1. Swap the package::
45
+
46
+ pip uninstall sphinx-gitstamp
47
+ pip install sphinx-last-updated-by-git
48
+
49
+ 2. In **conf.py**, replace the extension:
50
+
51
+ .. code-block:: python
52
+
53
+ extensions = ['sphinx_last_updated_by_git'] # was 'sphinx_gitstamp'
54
+
55
+ 3. Replace ``gitstamp_fmt`` with Sphinx's built-in ``html_last_updated_fmt``:
56
+
57
+ .. code-block:: python
58
+
59
+ html_last_updated_fmt = "%b %d, %Y" # was gitstamp_fmt
60
+
61
+ 4. In your templates, replace ``gitstamp`` with ``last_updated``:
62
+
63
+ .. code-block:: jinja
64
+
65
+ {%- if last_updated %} This page was last updated on {{ last_updated }}. {%- endif %}
66
+
67
+ If your theme already displays ``last_updated``, you can remove the custom
68
+ template code entirely.
69
+
70
+ 5. If you build from a shallow clone (e.g. GitHub Actions, Read the Docs),
71
+ fetch full history so dates are correct. See the
72
+ `sphinx-last-updated-by-git`_ README for details.
73
+
74
+ Installing
75
+ ----------
76
+
77
+ Directly install via pip by using::
78
+
79
+ pip install sphinx-gitstamp
80
+
81
+ Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
82
+ For example:
83
+
84
+ .. code-block:: python
85
+
86
+ extensions = ['sphinx_gitstamp']
87
+
88
+ To change the default time format of ``%b %d, %Y``, set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
89
+ For example:
90
+
91
+ .. code-block:: python
92
+
93
+ # Date format for git timestamps
94
+ gitstamp_fmt = "%Y-%m-%d %H:%M:%S %z"
95
+
96
+ Add ``gitstamp`` to the jinja template, for example:
97
+
98
+ .. code-block:: jinja
99
+
100
+ {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
101
+
102
+ Contributing
103
+ ------------
104
+
105
+ Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
106
+ contribute.
107
+
108
+ License
109
+ -------
110
+
111
+ **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
112
+ details.
113
+
114
+ Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
115
+ product includes software developed by Computing Services at Carnegie Mellon
116
+ University (http://www.cmu.edu/computing/).
117
+
118
+ .. _CONTRIBUTING: CONTRIBUTING.md
119
+ .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
120
+ .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
121
+ .. _gitpython: https://gitpython.readthedocs.io/en/stable/
122
+ .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
123
+ .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
124
+ .. _LICENSE: LICENSE
125
+ .. _Sphinx: http://sphinx-doc.org/
126
+ .. _sphinx-last-updated-by-git: https://github.com/mgeier/sphinx-last-updated-by-git
127
+ .. _time format: https://docs.python.org/2/library/time.html#time.strftime
128
+
129
+ .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
130
+ :target: https://pypi.python.org/pypi/sphinx-gitstamp
131
+ .. |Downloads| image:: https://static.pepy.tech/badge/sphinx-gitstamp/month
132
+ :target: https://pepy.tech/project/sphinx-gitstamp
133
+ .. |Code style: Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
134
+ :target: https://github.com/psf/black
135
+ .. |Parallel Safe| image:: https://img.shields.io/badge/parallel%20safe-true-brightgreen
@@ -0,0 +1,113 @@
1
+ Sphinx Gitstamp Generator Extension
2
+ ===================================
3
+
4
+ A `Sphinx`_ extension that inserts a git datestamp into the context as
5
+ ``gitstamp``, to make it available for template use in HTML versions of
6
+ your Sphinx documentation.
7
+
8
+ |PyPI version| |Downloads| |Code style: Black| |Parallel Safe|
9
+
10
+ .. warning::
11
+
12
+ **This project is deprecated and no longer maintained.**
13
+ Please use `sphinx-last-updated-by-git`_ instead. It provides the same
14
+ functionality plus dependency tracking (included files, images, etc.),
15
+ shallow clone detection, timezone support, and uses Sphinx's standard
16
+ ``last_updated`` template variable, so many themes display it out of
17
+ the box.
18
+
19
+ Migrating to sphinx-last-updated-by-git
20
+ ---------------------------------------
21
+
22
+ 1. Swap the package::
23
+
24
+ pip uninstall sphinx-gitstamp
25
+ pip install sphinx-last-updated-by-git
26
+
27
+ 2. In **conf.py**, replace the extension:
28
+
29
+ .. code-block:: python
30
+
31
+ extensions = ['sphinx_last_updated_by_git'] # was 'sphinx_gitstamp'
32
+
33
+ 3. Replace ``gitstamp_fmt`` with Sphinx's built-in ``html_last_updated_fmt``:
34
+
35
+ .. code-block:: python
36
+
37
+ html_last_updated_fmt = "%b %d, %Y" # was gitstamp_fmt
38
+
39
+ 4. In your templates, replace ``gitstamp`` with ``last_updated``:
40
+
41
+ .. code-block:: jinja
42
+
43
+ {%- if last_updated %} This page was last updated on {{ last_updated }}. {%- endif %}
44
+
45
+ If your theme already displays ``last_updated``, you can remove the custom
46
+ template code entirely.
47
+
48
+ 5. If you build from a shallow clone (e.g. GitHub Actions, Read the Docs),
49
+ fetch full history so dates are correct. See the
50
+ `sphinx-last-updated-by-git`_ README for details.
51
+
52
+ Installing
53
+ ----------
54
+
55
+ Directly install via pip by using::
56
+
57
+ pip install sphinx-gitstamp
58
+
59
+ Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
60
+ For example:
61
+
62
+ .. code-block:: python
63
+
64
+ extensions = ['sphinx_gitstamp']
65
+
66
+ To change the default time format of ``%b %d, %Y``, set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
67
+ For example:
68
+
69
+ .. code-block:: python
70
+
71
+ # Date format for git timestamps
72
+ gitstamp_fmt = "%Y-%m-%d %H:%M:%S %z"
73
+
74
+ Add ``gitstamp`` to the jinja template, for example:
75
+
76
+ .. code-block:: jinja
77
+
78
+ {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
79
+
80
+ Contributing
81
+ ------------
82
+
83
+ Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
84
+ contribute.
85
+
86
+ License
87
+ -------
88
+
89
+ **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
90
+ details.
91
+
92
+ Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
93
+ product includes software developed by Computing Services at Carnegie Mellon
94
+ University (http://www.cmu.edu/computing/).
95
+
96
+ .. _CONTRIBUTING: CONTRIBUTING.md
97
+ .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
98
+ .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
99
+ .. _gitpython: https://gitpython.readthedocs.io/en/stable/
100
+ .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
101
+ .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
102
+ .. _LICENSE: LICENSE
103
+ .. _Sphinx: http://sphinx-doc.org/
104
+ .. _sphinx-last-updated-by-git: https://github.com/mgeier/sphinx-last-updated-by-git
105
+ .. _time format: https://docs.python.org/2/library/time.html#time.strftime
106
+
107
+ .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
108
+ :target: https://pypi.python.org/pypi/sphinx-gitstamp
109
+ .. |Downloads| image:: https://static.pepy.tech/badge/sphinx-gitstamp/month
110
+ :target: https://pepy.tech/project/sphinx-gitstamp
111
+ .. |Code style: Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
112
+ :target: https://github.com/psf/black
113
+ .. |Parallel Safe| image:: https://img.shields.io/badge/parallel%20safe-true-brightgreen
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools",
4
+ ]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "sphinx-gitstamp"
9
+ description = "git timestamp generator for Sphinx"
10
+ authors = [
11
+ {name = "Jared Dillard", email = "jared.dillard@gmail.com"},
12
+ ]
13
+ maintainers = [
14
+ {name = "Jared Dillard", email = "jared.dillard@gmail.com"},
15
+ ]
16
+ classifiers=[
17
+ "Development Status :: 7 - Inactive",
18
+ "Framework :: Sphinx :: Extension",
19
+ "License :: OSI Approved :: BSD License",
20
+ "Programming Language :: Python :: 3.7",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Topic :: Documentation :: Sphinx",
26
+ ]
27
+ license = {text = "BSD-3-Clause"}
28
+ readme = "README.rst"
29
+ dynamic = [
30
+ "version",
31
+ ]
32
+
33
+ [project.urls]
34
+ download = "https://pypi.org/project/sphinx-gitstamp/"
35
+ source = "https://github.com/jdillard/sphinx-gitstamp"
36
+
37
+ [tool.isort]
38
+ profile = "black"
@@ -0,0 +1,13 @@
1
+ [metadata]
2
+ version = attr: sphinx_gitstamp.__version__
3
+
4
+ [options]
5
+ packages = find_namespace:
6
+ install_requires =
7
+ sphinx>=1.2
8
+ gitpython
9
+
10
+ [egg_info]
11
+ tag_build =
12
+ tag_date = 0
13
+
@@ -0,0 +1,4 @@
1
+ import setuptools
2
+
3
+ if __name__ == "__main__":
4
+ setuptools.setup()
@@ -8,11 +8,15 @@
8
8
  # The above copyright notice and this permission notice shall be included in
9
9
  # all copies or substantial portions of the Software.
10
10
 
11
+ import datetime
11
12
  import os
12
13
  import sys
13
- import datetime
14
+ from pathlib import Path
15
+
14
16
  from sphinx import errors
15
17
 
18
+ __version__ = "0.4.1"
19
+
16
20
  # Gets the datestamp of the latest commit on the given file
17
21
  # Converts the datestamp into something more readable
18
22
  # Skips files whose datestamp we can't parse.
@@ -20,85 +24,90 @@ from sphinx import errors
20
24
  # Output to June 7, 2017
21
25
 
22
26
 
27
+ def find_file_extension(file_name, source_suffix):
28
+ for ext, _ in source_suffix.items():
29
+ file_path = str(file_name) + ext
30
+ if os.path.exists(file_path):
31
+ return file_path
32
+ return None
33
+
34
+
23
35
  def page_context_handler(app, pagename, templatename, context, doctree):
24
36
  import git
37
+
25
38
  global g
26
39
  if g is None:
27
40
  # We have already errored about this
28
41
  pass
29
- fullpagename = pagename
30
- docsrc = ''
31
- try:
32
- docsrc = app.confdir + "/"
33
- if docsrc != "/":
34
- fullpagename = docsrc + pagename
35
- except KeyError:
36
- pass
37
42
 
38
- # Don't barf on "genindex", "search", etc
39
- if not os.path.isfile("%s.rst" % fullpagename):
43
+ fullpagename = Path(app.confdir, pagename)
44
+
45
+ # Find file extension. If not in the list we skip this file.
46
+ file_path = find_file_extension(fullpagename, app.config.source_suffix)
47
+ if file_path is None:
40
48
  return
41
49
 
42
50
  try:
43
- updated = g.log('--pretty=format:%ai', '-n 1', "%s.rst" % fullpagename)
44
- updated = updated[:10]
45
-
51
+ updated = g.log("--pretty=format:%ai", "-n 1", file_path)
52
+ updated = updated[:25]
46
53
  if updated == "":
47
54
  # Don't datestamp generated rst's (e.g. imapd.conf.rst)
48
55
  # Ideally want to check their source - lib/imapoptions, etc, but
49
56
  # that involves getting the source/output pair into the extension.
50
57
  return
51
-
52
- context['gitstamp'] = datetime.datetime.strptime(
53
- updated,
54
- "%Y-%m-%d"
55
- ).strftime(
56
- app.config.gitstamp_fmt
57
- )
58
+ dt_object = datetime.datetime.strptime(updated, "%Y-%m-%d %H:%M:%S %z")
59
+ context["gitstamp"] = dt_object.strftime(app.config.gitstamp_fmt)
58
60
  except git.exc.GitCommandError:
59
61
  # File doesn't exist or something else went wrong.
60
- raise errors.ExtensionError("Can't fetch git history for %s.rst." %
61
- fullpagename)
62
+ raise errors.ExtensionError("Can't fetch git history for %s." % file_path)
62
63
  except ValueError:
63
64
  # Datestamp can't be parsed.
64
- app.info("%s: Can't parse datestamp () %s ) for gitstamp, output \
65
- won't have last updated time." % (pagename, updated))
65
+ app.info(
66
+ "%s: Can't parse datestamp () %s ) for gitstamp, output \
67
+ won't have last updated time."
68
+ % (pagename, updated)
69
+ )
66
70
  pass
67
71
 
68
72
 
69
73
  # Only add the page context handler if we're generating html
70
74
  def what_build_am_i(app):
71
75
  global g
72
- if (app.builder.format != 'html'):
76
+ if app.builder.format != "html":
73
77
  return
74
78
 
75
79
  try:
76
80
  import git
77
81
  except ImportError as e:
78
- raise errors.ExtensionError(f"""Unable to import gitpython. \
82
+ raise errors.ExtensionError(
83
+ f"""Unable to import gitpython. \
79
84
  Required to generate html. You may need to run: pip install gitpython.
80
85
 
81
86
  The error was: {e}
82
- """)
87
+ """
88
+ )
83
89
 
84
90
  try:
85
91
  global g
86
- g = git.Git('.')
92
+ g = git.Git(".")
87
93
  except BaseException:
88
94
  app.info(sys.exc_info()[0])
89
- app.warn("gitstamp extension enabled, but no git repository found. No \
90
- git datestamps will be generated.")
95
+ app.warn(
96
+ "gitstamp extension enabled, but no git repository found. No \
97
+ git datestamps will be generated."
98
+ )
91
99
  else:
92
- app.connect('html-page-context', page_context_handler)
100
+ app.connect("html-page-context", page_context_handler)
93
101
 
94
102
 
95
103
  # We can't immediately add a page context handler: we need to wait until we
96
104
  # know what the build output format is.
97
105
  def setup(app):
98
- app.add_config_value('gitstamp_fmt', "%b %d, %Y", 'html')
99
- app.connect('builder-inited', what_build_am_i)
106
+ app.add_config_value("gitstamp_fmt", "%b %d, %Y", "html")
107
+ app.connect("builder-inited", what_build_am_i)
100
108
 
101
109
  return {
102
- 'parallel_read_safe': True,
103
- 'parallel_write_safe': True
110
+ "parallel_read_safe": True,
111
+ "parallel_write_safe": True,
112
+ "version": __version__,
104
113
  }
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-gitstamp
3
+ Version: 0.4.1
4
+ Summary: git timestamp generator for Sphinx
5
+ Author-email: Jared Dillard <jared.dillard@gmail.com>
6
+ Maintainer-email: Jared Dillard <jared.dillard@gmail.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: download, https://pypi.org/project/sphinx-gitstamp/
9
+ Project-URL: source, https://github.com/jdillard/sphinx-gitstamp
10
+ Classifier: Development Status :: 7 - Inactive
11
+ Classifier: Framework :: Sphinx :: Extension
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Topic :: Documentation :: Sphinx
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ Sphinx Gitstamp Generator Extension
24
+ ===================================
25
+
26
+ A `Sphinx`_ extension that inserts a git datestamp into the context as
27
+ ``gitstamp``, to make it available for template use in HTML versions of
28
+ your Sphinx documentation.
29
+
30
+ |PyPI version| |Downloads| |Code style: Black| |Parallel Safe|
31
+
32
+ .. warning::
33
+
34
+ **This project is deprecated and no longer maintained.**
35
+ Please use `sphinx-last-updated-by-git`_ instead. It provides the same
36
+ functionality plus dependency tracking (included files, images, etc.),
37
+ shallow clone detection, timezone support, and uses Sphinx's standard
38
+ ``last_updated`` template variable, so many themes display it out of
39
+ the box.
40
+
41
+ Migrating to sphinx-last-updated-by-git
42
+ ---------------------------------------
43
+
44
+ 1. Swap the package::
45
+
46
+ pip uninstall sphinx-gitstamp
47
+ pip install sphinx-last-updated-by-git
48
+
49
+ 2. In **conf.py**, replace the extension:
50
+
51
+ .. code-block:: python
52
+
53
+ extensions = ['sphinx_last_updated_by_git'] # was 'sphinx_gitstamp'
54
+
55
+ 3. Replace ``gitstamp_fmt`` with Sphinx's built-in ``html_last_updated_fmt``:
56
+
57
+ .. code-block:: python
58
+
59
+ html_last_updated_fmt = "%b %d, %Y" # was gitstamp_fmt
60
+
61
+ 4. In your templates, replace ``gitstamp`` with ``last_updated``:
62
+
63
+ .. code-block:: jinja
64
+
65
+ {%- if last_updated %} This page was last updated on {{ last_updated }}. {%- endif %}
66
+
67
+ If your theme already displays ``last_updated``, you can remove the custom
68
+ template code entirely.
69
+
70
+ 5. If you build from a shallow clone (e.g. GitHub Actions, Read the Docs),
71
+ fetch full history so dates are correct. See the
72
+ `sphinx-last-updated-by-git`_ README for details.
73
+
74
+ Installing
75
+ ----------
76
+
77
+ Directly install via pip by using::
78
+
79
+ pip install sphinx-gitstamp
80
+
81
+ Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
82
+ For example:
83
+
84
+ .. code-block:: python
85
+
86
+ extensions = ['sphinx_gitstamp']
87
+
88
+ To change the default time format of ``%b %d, %Y``, set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
89
+ For example:
90
+
91
+ .. code-block:: python
92
+
93
+ # Date format for git timestamps
94
+ gitstamp_fmt = "%Y-%m-%d %H:%M:%S %z"
95
+
96
+ Add ``gitstamp`` to the jinja template, for example:
97
+
98
+ .. code-block:: jinja
99
+
100
+ {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
101
+
102
+ Contributing
103
+ ------------
104
+
105
+ Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
106
+ contribute.
107
+
108
+ License
109
+ -------
110
+
111
+ **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
112
+ details.
113
+
114
+ Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
115
+ product includes software developed by Computing Services at Carnegie Mellon
116
+ University (http://www.cmu.edu/computing/).
117
+
118
+ .. _CONTRIBUTING: CONTRIBUTING.md
119
+ .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
120
+ .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
121
+ .. _gitpython: https://gitpython.readthedocs.io/en/stable/
122
+ .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
123
+ .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
124
+ .. _LICENSE: LICENSE
125
+ .. _Sphinx: http://sphinx-doc.org/
126
+ .. _sphinx-last-updated-by-git: https://github.com/mgeier/sphinx-last-updated-by-git
127
+ .. _time format: https://docs.python.org/2/library/time.html#time.strftime
128
+
129
+ .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
130
+ :target: https://pypi.python.org/pypi/sphinx-gitstamp
131
+ .. |Downloads| image:: https://static.pepy.tech/badge/sphinx-gitstamp/month
132
+ :target: https://pepy.tech/project/sphinx-gitstamp
133
+ .. |Code style: Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
134
+ :target: https://github.com/psf/black
135
+ .. |Parallel Safe| image:: https://img.shields.io/badge/parallel%20safe-true-brightgreen
@@ -1,12 +1,14 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.rst
4
+ pyproject.toml
4
5
  setup.cfg
5
6
  setup.py
6
7
  sphinx_gitstamp/__init__.py
7
- sphinx_gitstamp/version.py
8
8
  sphinx_gitstamp.egg-info/PKG-INFO
9
9
  sphinx_gitstamp.egg-info/SOURCES.txt
10
10
  sphinx_gitstamp.egg-info/dependency_links.txt
11
- sphinx_gitstamp.egg-info/requires.txt
12
- sphinx_gitstamp.egg-info/top_level.txt
11
+ sphinx_gitstamp.egg-info/top_level.txt
12
+ tests/conftest.py
13
+ tests/test_simple.py
14
+ tests/roots/test-root/conf.py
@@ -0,0 +1,24 @@
1
+ from pathlib import Path
2
+
3
+ import pytest
4
+ import sphinx
5
+
6
+ pytest_plugins = "sphinx.testing.fixtures"
7
+ # Exclude 'roots' dirs for pytest test collector
8
+ collect_ignore = ["roots"]
9
+
10
+
11
+ def pytest_configure(config):
12
+ # before Sphinx 3.3.0, the `sphinx` marker is not registered by
13
+ # the extension (but by Sphinx's internal pytest config)
14
+ config.addinivalue_line("markers", "sphinx")
15
+
16
+
17
+ @pytest.fixture(scope="session")
18
+ def rootdir():
19
+ if sphinx.version_info[:2] < (7, 2):
20
+ from sphinx.testing.path import path
21
+
22
+ return path(__file__).parent.abspath() / "roots"
23
+
24
+ return Path(__file__).resolve().parent / "roots"
@@ -0,0 +1 @@
1
+ extensions = ["sphinx_gitstamp"]
@@ -0,0 +1,11 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.mark.sphinx(
5
+ "html",
6
+ freshenv=True,
7
+ confoverrides={"gitstamp_fmt": "%b %d, %Y"},
8
+ )
9
+ def test_simple(app, status, warning):
10
+ app.build()
11
+ assert "bar.html" in app.outdir.listdir()
@@ -1,80 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: sphinx-gitstamp
3
- Version: 0.3.3
4
- Summary: git timestamp generator for Sphinx
5
- Home-page: https://github.com/jdillard/sphinx-gitstamp
6
- Author: Jared Dillard
7
- Author-email: jared.dillard@gmail.com
8
- License: MIT
9
- Download-URL: https://github.com/jdillard/sphinx-gitstamp/archive/v0.3.3.tar.gz
10
- Description: Sphinx Gitstamp Generator Extension
11
- ===================================
12
-
13
- A `Sphinx`_ extension that inserts a git datestamp into the context as
14
- ``gitstamp``, to make it available for template use in HTML versions of
15
- your Sphinx documentation.
16
-
17
- |Build Status| |PyPI version| |Downloads| |License: BSD|
18
-
19
- Installing
20
- ----------
21
-
22
- Directly install via pip by using::
23
-
24
- pip install sphinx-gitstamp
25
-
26
- Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
27
- For example::
28
-
29
- extensions = ['sphinx_gitstamp']
30
-
31
- Set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
32
- For example::
33
-
34
- # Date format for git timestamps
35
- gitstamp_fmt = "%b %d, %Y"
36
-
37
- Add ``gitstamp`` to the template, for example::
38
-
39
- {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
40
-
41
- Contributing
42
- ------------
43
-
44
- Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
45
- contribute.
46
-
47
- License
48
- -------
49
-
50
- **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
51
- details.
52
-
53
- Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
54
- product includes software developed by Computing Services at Carnegie Mellon
55
- University (http://www.cmu.edu/computing/).
56
-
57
- .. _CONTRIBUTING: CONTRIBUTING.md
58
- .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
59
- .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
60
- .. _gitpython: https://gitpython.readthedocs.io/en/stable/
61
- .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
62
- .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
63
- .. _LICENSE: LICENSE
64
- .. _Sphinx: http://sphinx-doc.org/
65
- .. _time format: https://docs.python.org/2/library/time.html#time.strftime
66
-
67
- .. |Build Status| image:: https://travis-ci.org/jdillard/sphinx-gitstamp.svg?branch=master
68
- :target: https://travis-ci.org/jdillard/sphinx-gitstamp
69
- .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
70
- :target: https://pypi.python.org/pypi/sphinx-gitstamp
71
- .. |Downloads| image:: https://pepy.tech/badge/sphinx-gitstamp/week
72
- :target: https://pepy.tech/project/sphinx-gitstamp
73
- .. |License: BSD| image:: https://img.shields.io/badge/License-BSD-blue.svg
74
- :target: https://github.com/jdillard/sphinx-gitstamp/blob/master/LICENSE
75
-
76
- Platform: UNKNOWN
77
- Classifier: License :: OSI Approved :: BSD License
78
- Classifier: Topic :: Documentation :: Sphinx
79
- Classifier: Programming Language :: Python :: 3
80
- Classifier: Framework :: Sphinx :: Extension
@@ -1,65 +0,0 @@
1
- Sphinx Gitstamp Generator Extension
2
- ===================================
3
-
4
- A `Sphinx`_ extension that inserts a git datestamp into the context as
5
- ``gitstamp``, to make it available for template use in HTML versions of
6
- your Sphinx documentation.
7
-
8
- |Build Status| |PyPI version| |Downloads| |License: BSD|
9
-
10
- Installing
11
- ----------
12
-
13
- Directly install via pip by using::
14
-
15
- pip install sphinx-gitstamp
16
-
17
- Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
18
- For example::
19
-
20
- extensions = ['sphinx_gitstamp']
21
-
22
- Set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
23
- For example::
24
-
25
- # Date format for git timestamps
26
- gitstamp_fmt = "%b %d, %Y"
27
-
28
- Add ``gitstamp`` to the template, for example::
29
-
30
- {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
31
-
32
- Contributing
33
- ------------
34
-
35
- Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
36
- contribute.
37
-
38
- License
39
- -------
40
-
41
- **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
42
- details.
43
-
44
- Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
45
- product includes software developed by Computing Services at Carnegie Mellon
46
- University (http://www.cmu.edu/computing/).
47
-
48
- .. _CONTRIBUTING: CONTRIBUTING.md
49
- .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
50
- .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
51
- .. _gitpython: https://gitpython.readthedocs.io/en/stable/
52
- .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
53
- .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
54
- .. _LICENSE: LICENSE
55
- .. _Sphinx: http://sphinx-doc.org/
56
- .. _time format: https://docs.python.org/2/library/time.html#time.strftime
57
-
58
- .. |Build Status| image:: https://travis-ci.org/jdillard/sphinx-gitstamp.svg?branch=master
59
- :target: https://travis-ci.org/jdillard/sphinx-gitstamp
60
- .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
61
- :target: https://pypi.python.org/pypi/sphinx-gitstamp
62
- .. |Downloads| image:: https://pepy.tech/badge/sphinx-gitstamp/week
63
- :target: https://pepy.tech/project/sphinx-gitstamp
64
- .. |License: BSD| image:: https://img.shields.io/badge/License-BSD-blue.svg
65
- :target: https://github.com/jdillard/sphinx-gitstamp/blob/master/LICENSE
@@ -1,7 +0,0 @@
1
- [metadata]
2
- description-file = README.rst
3
-
4
- [egg_info]
5
- tag_build =
6
- tag_date = 0
7
-
@@ -1,26 +0,0 @@
1
- from setuptools import setup
2
- import os
3
-
4
- long_description = open('README.rst' if os.path.exists('README.rst') else 'README.md').read()
5
- exec(compile(
6
- open('sphinx_gitstamp/version.py').read(), 'sphinx_gitstamp/version.py', 'exec'))
7
-
8
- setup(
9
- name='sphinx-gitstamp',
10
- description='git timestamp generator for Sphinx',
11
- long_description=long_description,
12
- classifiers=[
13
- 'License :: OSI Approved :: BSD License',
14
- 'Topic :: Documentation :: Sphinx',
15
- 'Programming Language :: Python :: 3',
16
- 'Framework :: Sphinx :: Extension',
17
- ],
18
- version=__version__,
19
- author='Jared Dillard',
20
- author_email='jared.dillard@gmail.com',
21
- install_requires=['six', 'sphinx >= 1.2', 'gitpython'],
22
- url="https://github.com/jdillard/sphinx-gitstamp",
23
- license='MIT',
24
- download_url="https://github.com/jdillard/sphinx-gitstamp/archive/v0.3.3.tar.gz",
25
- packages=['sphinx_gitstamp'],
26
- )
@@ -1 +0,0 @@
1
- __version__ = '0.3.3'
@@ -1,80 +0,0 @@
1
- Metadata-Version: 1.1
2
- Name: sphinx-gitstamp
3
- Version: 0.3.3
4
- Summary: git timestamp generator for Sphinx
5
- Home-page: https://github.com/jdillard/sphinx-gitstamp
6
- Author: Jared Dillard
7
- Author-email: jared.dillard@gmail.com
8
- License: MIT
9
- Download-URL: https://github.com/jdillard/sphinx-gitstamp/archive/v0.3.3.tar.gz
10
- Description: Sphinx Gitstamp Generator Extension
11
- ===================================
12
-
13
- A `Sphinx`_ extension that inserts a git datestamp into the context as
14
- ``gitstamp``, to make it available for template use in HTML versions of
15
- your Sphinx documentation.
16
-
17
- |Build Status| |PyPI version| |Downloads| |License: BSD|
18
-
19
- Installing
20
- ----------
21
-
22
- Directly install via pip by using::
23
-
24
- pip install sphinx-gitstamp
25
-
26
- Add ``sphinx_gitstamp`` to the `extensions`_ array in your Sphinx **conf.py**.
27
- For example::
28
-
29
- extensions = ['sphinx_gitstamp']
30
-
31
- Set the value of ``gitstamp_fmt`` in **conf.py** to the desired `time format`_.
32
- For example::
33
-
34
- # Date format for git timestamps
35
- gitstamp_fmt = "%b %d, %Y"
36
-
37
- Add ``gitstamp`` to the template, for example::
38
-
39
- {%- if gitstamp %} This page was last updated on {{ gitstamp }}. {%- endif %}
40
-
41
- Contributing
42
- ------------
43
-
44
- Pull Requests welcome! See `CONTRIBUTING`_ for instructions on how best to
45
- contribute.
46
-
47
- License
48
- -------
49
-
50
- **sphinx-gitstamp** is made available under a **BSD license**; see `LICENSE`_ for
51
- details.
52
-
53
- Originally based on the gitstamp generator in the `cyrus-imapd`_ project. This
54
- product includes software developed by Computing Services at Carnegie Mellon
55
- University (http://www.cmu.edu/computing/).
56
-
57
- .. _CONTRIBUTING: CONTRIBUTING.md
58
- .. _cyrus-imapd: https://github.com/cyrusimap/cyrus-imapd/pull/2029/files
59
- .. _extensions: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions
60
- .. _gitpython: https://gitpython.readthedocs.io/en/stable/
61
- .. _html_extra_path: http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
62
- .. _language: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language
63
- .. _LICENSE: LICENSE
64
- .. _Sphinx: http://sphinx-doc.org/
65
- .. _time format: https://docs.python.org/2/library/time.html#time.strftime
66
-
67
- .. |Build Status| image:: https://travis-ci.org/jdillard/sphinx-gitstamp.svg?branch=master
68
- :target: https://travis-ci.org/jdillard/sphinx-gitstamp
69
- .. |PyPI version| image:: https://img.shields.io/pypi/v/sphinx-gitstamp.svg
70
- :target: https://pypi.python.org/pypi/sphinx-gitstamp
71
- .. |Downloads| image:: https://pepy.tech/badge/sphinx-gitstamp/week
72
- :target: https://pepy.tech/project/sphinx-gitstamp
73
- .. |License: BSD| image:: https://img.shields.io/badge/License-BSD-blue.svg
74
- :target: https://github.com/jdillard/sphinx-gitstamp/blob/master/LICENSE
75
-
76
- Platform: UNKNOWN
77
- Classifier: License :: OSI Approved :: BSD License
78
- Classifier: Topic :: Documentation :: Sphinx
79
- Classifier: Programming Language :: Python :: 3
80
- Classifier: Framework :: Sphinx :: Extension
@@ -1,3 +0,0 @@
1
- gitpython
2
- six
3
- sphinx>=1.2
File without changes