[svnbook commit] r1304 - in trunk/src: en nb tools

cmpilato svnbook-dev at red-bean.com
Tue May 17 14:30:31 CDT 2005


Author: cmpilato
Date: Tue May 17 14:30:29 2005
New Revision: 1304

Added:
   trunk/src/tools/book-dist.py
      - copied, changed from r1300, trunk/src/en/book-dist.py
Removed:
   trunk/src/en/book-dist.py
   trunk/src/nb/HACKING
   trunk/src/nb/README
   trunk/src/nb/REVIEW
   trunk/src/nb/TODO
   trunk/src/nb/book-dist.py
   trunk/src/nb/outline.txt
Log:
Cleanups in the svnbook repository.

* src/nb/REVIEW
* src/nb/book-dist.py
* src/nb/HACKING
* src/nb/TODO
* src/nb/README
* src/nb/outline.txt
  Remove a bunch of uninteresting copies of 'en' files.  (If relevant
  across locales, these should perhaps be moved to the top-level src/
  directory.)

* src/en/book-dist.py
  Move this...

* src/tools/book-dist.py
  ...to hear, and tweak a bit for use with different locales.


Copied: trunk/src/tools/book-dist.py (from r1300, trunk/src/en/book-dist.py)
==============================================================================
--- trunk/src/en/book-dist.py	(original)
+++ trunk/src/tools/book-dist.py	Tue May 17 14:30:29 2005
@@ -7,34 +7,40 @@
 def die(msg):
   sys.stderr.write('ERROR: ' + msg)
   sys.exit(1)
+
+if len(sys.argv) < 2:
+  die("Usage: %s LOCALE [TARGET...]\n" % (os.path.basename(sys.argv[0])))
   
+elif len(sys.argv) == 2:
+  locale = sys.argv[1]
+  targets = ['install-book-html',
+             'install-book-html-chunk',
+             'install-book-pdf']
+else:
+  locale = sys.argv[1]
+  targets = sys.argv[2:]
+
 cwd = os.getcwd()
 if not os.path.exists('book') \
    or not os.path.exists('Makefile'):
   die('Please run this from the Subversion book source directory\n')
   
 if not os.getenv('JAVA_HOME'):
-  die('JAVA_HOME is not set correctly.\n')
-
-if os.path.exists('./usr'):
-  die('Please remove ./usr.\n')
+  die('JAVA_HOME is not set.\n')
 
+tarball_base = os.path.join(cwd, 'svnbook-%s' % (locale))
 os.putenv('FOP_OPTS', '-Xms100m -Xmx200m')
 
-os.system('DESTDIR=. make book-clean install-book-html ' + \
-          'install-book-html-chunk install-book-pdf')
-
-tarball = os.path.join(cwd, 'svnbook.tar.gz')
-
 try:
-  os.chdir('./usr/share/doc/subversion')
-  os.rename('book', 'svnbook')
-  os.system('tar cvfz ' + tarball + ' svnbook')
+  os.mkdir('svnbook-tmp')
+  os.system('DESTDIR=svnbook-tmp make book-clean %s' % (' '.join(targets)))
+  os.rename('svnbook-tmp/usr/share/doc/subversion/book', tarball_base)
+  os.system('tar cvfz ' + tarball_base + '.tar.gz ' + tarball_base)
 finally:
-  os.chdir(cwd)
-  shutil.rmtree('./usr')
+  shutil.rmtree(tarball_base)
+  shutil.rmtree('svnbook-tmp')
   
-if not os.path.exists(tarball):
+if not os.path.exists(tarball_base + '.tar.gz'):
   die('Hrm.  It appears the tarball was not created.\n')
 
-print 'Your tarball sits in ./svnbook.tar.gz.  Enjoy!'
+print 'Your tarball sits in %s.tar.gz.  Enjoy!' % (tarball_base)



More information about the svnbook-dev mailing list