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

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

Closed
Arfrever opened this issue May 17, 2012 · 1 comment
Closed

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

Arfrever opened this issue May 17, 2012 · 1 comment

Comments

@Arfrever
Copy link

@Arfrever Arfrever commented May 17, 2012

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).

=============================================================================================================================================================

Aborting.
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/conf.py
+++ docs/conf.py
@@ -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}

--- setup.py
+++ setup.py
@@ -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')
+        _sdist.run(self)
+        os.unlink('docs/git_tags')
+
 setup(
     name='Fabric',
     version=get_version('short'),
@@ -64,4 +72,5 @@
           'Topic :: System :: Software Distribution',
           'Topic :: System :: Systems Administration',
     ],
+    cmdclass={'sdist': sdist},
 )
@bitprophet
Copy link
Member

@bitprophet bitprophet commented May 17, 2012

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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants