From 28cf04764e8624e0e8c1bf3c84c0c8e4d58ae2a2 2011-08-24 00:29:00
From: MinRK <benjaminrk@gmail.com>
Date: 2011-08-24 00:29:00
Subject: [PATCH] gh-pages tweaks

* `make gh-pages` depends on clean,html not html,pdf
* don't build pdf for dev docs
* use `git describe --exact-match` to prevent long tag on dev
* use `git add -A`, so removed files are noticed

---

diff --git a/docs/Makefile b/docs/Makefile
index 21278c0..93ae023 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -106,5 +106,5 @@ gitwash-update:
 nightly: dist
 	rsync -avH --delete dist/ ipython:www/doc/nightly
 
-gh-pages: html pdf
+gh-pages: clean html
 	python gh-pages.py
diff --git a/docs/gh-pages.py b/docs/gh-pages.py
index dd360f8..577341d 100755
--- a/docs/gh-pages.py
+++ b/docs/gh-pages.py
@@ -83,7 +83,7 @@ if __name__ == '__main__':
         tag = sys.argv[1]
     except IndexError:
         try:
-            tag = sh2('git describe')
+            tag = sh2('git describe --exact-match')
         except CalledProcessError:
             tag = "dev"   # Fallback
     
@@ -102,12 +102,16 @@ if __name__ == '__main__':
 
     # don't `make html` here, because gh-pages already depends on html in Makefile
     # sh('make html')
+    if tag != 'dev':
+        # only build pdf for non-dev targets
+        sh2('make pdf')
 
     # This is pretty unforgiving: we unconditionally nuke the destination
     # directory, and then copy the html tree in there
     shutil.rmtree(dest, ignore_errors=True)
     shutil.copytree(html_dir, dest)
-    shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))
+    if tag != 'dev':
+        shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))
 
     try:
         cd(pages_dir)
@@ -118,7 +122,7 @@ if __name__ == '__main__':
                                                                  branch)
             raise RuntimeError(e)
 
-        sh('git add %s' % tag)
+        sh('git add -A %s' % tag)
         sh('git commit -m"Updated doc release: %s"' % tag)
         print
         print 'Most recent 3 commits:'