Installation script and cosmetic tweaks in output

Tue, 24 Feb 2009 15:35:41 +0000

author
andy
date
Tue, 24 Feb 2009 15:35:41 +0000
changeset 13
32883d89ca7f
parent 12
468dd1a77779
child 14
73e0b44f6844

Installation script and cosmetic tweaks in output

emin file | annotate | diff | comparison | revisions
setup.py file | annotate | diff | comparison | revisions
     1.1 --- a/emin	Tue Feb 10 14:12:39 2009 +0000
     1.2 +++ b/emin	Tue Feb 24 15:35:41 2009 +0000
     1.3 @@ -24,6 +24,9 @@
     1.4   * Try to import BeautifulSoup for validating/pretty-printing the output
     1.5   * Resize option
     1.6   * Rename option
     1.7 + * Crop-to-thumb option
     1.8 + * Rotate by EXIF orientation
     1.9 + * Copy Lightbox stuff into place
    1.10   * Allow complete rollback if any failure (or on demand?)
    1.11  """
    1.12  
    1.13 @@ -324,11 +327,14 @@
    1.14      if not "." in ZIPFILE or os.path.splitextn(ZIPFILE)[1] != ".zip":
    1.15          ZIPFILE += ".zip"
    1.16      ## Do the zipping
    1.17 -    from zipfile import ZipFile
    1.18 -    zf = ZipFile(os.path.join(opts.OUTDIR, ZIPFILE), "w")
    1.19 -    for img in imgs:
    1.20 -        zf.write(img, os.path.basename(img))
    1.21 -    zf.close()
    1.22 +    if ZIPFILE:
    1.23 +        from zipfile import ZipFile
    1.24 +        zf = ZipFile(os.path.join(opts.OUTDIR, ZIPFILE), "w")
    1.25 +        for img in imgs:
    1.26 +            zf.write(img, os.path.basename(img))
    1.27 +        zf.close()
    1.28 +    else:
    1.29 +        logging.warning("No zip file made because zip filename is empty")
    1.30  
    1.31  
    1.32  ## Copy Lightbox stuff into place
    1.33 @@ -346,12 +352,18 @@
    1.34          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    1.35  <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    1.36    <head>
    1.37 -    #set title = $PAGETITLE + " (page %s)" % $PAGENUM
    1.38 +    #set title = $PAGETITLE
    1.39 +    #if $NUM_PAGES > 1
    1.40 +    #set title = $title + " (page %s)" % $PAGENUM
    1.41 +    #end if
    1.42      <title>$title</title>
    1.43      <style>
    1.44 -      img { border:0; margin:5px; }
    1.45 +      img { border:0; padding:10 10 0 0; }
    1.46        body { padding:1em; background:white; font-family:sans-serif; }
    1.47        h1 { font-family:sans-serif; }
    1.48 +      a.format { text-decoration:none; font-variant:small-caps; color:grey; font-size:small; }
    1.49 +      a.format:hover { color:deeppink; }
    1.50 +      a.format:active { color:deeppink; }
    1.51      </style>
    1.52      #if $OPTS.USE_JS:
    1.53      <link rel="stylesheet" href="lightbox/css/lightbox.css" type="text/css" media="screen" />	
    1.54 @@ -382,7 +394,7 @@
    1.55            <img alt="$thumb" src="$info.relthumbpath" style="border:0;" width="$info.thumbx" height="$info.thumby" />
    1.56          </a><br/>
    1.57          #for fmt, name in $info.versions.iteritems()
    1.58 -        <a href="$name">$fmt.lower()</a>
    1.59 +        <a class="format" href="$name">$fmt.lower()</a>
    1.60          #end for
    1.61        </td>
    1.62      #end for
    1.63 @@ -393,7 +405,7 @@
    1.64      <div class="pagelinks">Pages: $LINKSTR</div>
    1.65      #end if
    1.66  
    1.67 -    #if $OPTS.WRITE_ZIPFILE:
    1.68 +    #if $OPTS.WRITE_ZIPFILE and $ZIPFILE:
    1.69      <p>All zipped up: <a href="$ZIPFILE">$ZIPFILE</a></p>
    1.70      #end if
    1.71    </body>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/setup.py	Tue Feb 24 15:35:41 2009 +0000
     2.3 @@ -0,0 +1,42 @@
     2.4 +#! /usr/bin/env python
     2.5 +
     2.6 +"""emin: a simple builder of static Web galleries."""
     2.7 +
     2.8 +## Get setuptools
     2.9 +import ez_setup
    2.10 +ez_setup.use_setuptools()
    2.11 +from setuptools import setup
    2.12 +
    2.13 +longdesc = """\
    2.14 +emin is a script used to make static HTML-based galleries of
    2.15 +photos, PDFs, diagrams... anything, really. It's primarily
    2.16 +intended for making Web photo galleries for the sorts of
    2.17 +people who don't want to install some PHP monstrosity just
    2.18 +to put their photos online. On the assumption that most people 
    2.19 +will want to tweak their gallery's appearance, the output is
    2.20 +fully customisable using the Cheetah templating engine. 
    2.21 +
    2.22 +Supported image formats are JPEG, PNG, GIF, TIFF, PDF and EPS,
    2.23 +with the latter two being converted to PNG for Web display.
    2.24 +Image resizing, renaming and thumbnailing is supported, as is
    2.25 +building a zip file to download the whole set. Large image sets
    2.26 +can be split over several pages.
    2.27 +"""
    2.28 +
    2.29 +## Setup definition
    2.30 +setup(name = 'emin',
    2.31 +      version = "0.1.0",
    2.32 +      scripts = ['emin'],
    2.33 +      author = ['Andy Buckley'],
    2.34 +      author_email = 'andy@insectnation.org',
    2.35 +      #url = 'http://www.insectnation.org/projects/emin/',
    2.36 +      description = 'A simple builder of static Web galleries.',
    2.37 +      #long_description = longdesc,
    2.38 +      keywords = 'photo gallery web www html template',
    2.39 +      license = 'GPL',
    2.40 +      classifiers = ['Development Status :: 4 - Beta',
    2.41 +                   'Environment :: Console', 'Environment :: WWW',
    2.42 +                   'License :: OSI Approved :: GNU General Public License (GPL)',
    2.43 +                   'Operating System :: OS Independent',
    2.44 +                   'Programming Language :: Python']
    2.45 +      )

mercurial