Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Include static list of git tags in release tarballs available in PyPI #645

Arfrever opened this Issue · 1 comment

2 participants


After fixing of #640 and #644, generation of documentation in release tarballs would still fail due to missing .git directory:

$ make html
sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.1.3

Fatal error: local() encountered an error (return code 1) while executing 'git tag | sort -r | egrep "(1\.[^0]+)\.."'

====================================================================== Standard error ======================================================================

fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).


make: *** [html] Error 1
$ git tag
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I suggest to include static list of git tags in docs/git_tags file in generated tarballs:

--- docs/
+++ docs/
@@ -172,7 +172,10 @@

 from fabric.api import local, hide
 with hide('everything'):
-    get_tags = 'git tag | sort -r | egrep "(1\.[^0]+)\.."'
+    if os.path.exists('git_tags'):
+        get_tags = 'sort -r git_tags | egrep "(1\.[^0]+)\.."'
+    else:
+        get_tags = 'git tag | sort -r | egrep "(1\.[^0]+)\.."'
     fabric_tags = local(get_tags, True).split()
 html_context = {'fabric_tags': fabric_tags}

@@ -1,8 +1,10 @@
 #!/usr/bin/env python

+import os
 import sys

 from setuptools import setup, find_packages
+from setuptools.command.sdist import sdist as _sdist

 from fabric.version import get_version

@@ -27,6 +29,12 @@
 For more information, please see the Fabric website or execute ``fab --help``.
 """ % (v, readme)

+class sdist(_sdist):
+    def run(self):
+        os.system('git tag > docs/git_tags')
+        os.unlink('docs/git_tags')
@@ -64,4 +72,5 @@
           'Topic :: System :: Software Distribution',
           'Topic :: System :: Systems Administration',
+    cmdclass={'sdist': sdist},

Good catch, sorry about that.

I think it's best to simply not print that part of the sidebar if the user is not operating out of a Git checkout. The sidebar is almost entirely there so I can manually generate docs and push to RTD and still have something resembling a version nav. Don't think that's worth having a brittle-ish sync of that tag file.

I'll fix this in a minute hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.