Changeset 9471


Ignore:
Timestamp:
Dec 3, 2014 2:43:35 PM (4 years ago)
Author:
jdsiiro
Message:

Adding a --version option to pyomo_install so users can tell us which version of the script they are using.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyomo/trunk/scripts/pyomo_install

    • Property svn:keywords set to Date Revision
    r9468 r9471  
    33# An installer for Pyomo
    44#
     5# $Revision$
     6# $Date$
    57
    68import glob
     
    1517import logging
    1618import tempfile
     19
     20__version__ = "trunk"
     21src_revision = "$Revision$"
     22
     23def version_str():
     24    import re
     25    ans = __version__
     26    m = re.match('\$Revision:\s*(\S+)\s*\$', src_revision)
     27    if m:
     28        ans = ans + " (r%s)" % (m.group(1))
     29    return ans
    1730
    1831logger = logging.getLogger('pyomo_install')
     
    217230virtual python environment is created in the 'pyomo' directory.
    218231"""
     232    parser.add_option("--version",
     233        action="store_true",
     234        dest="version",
     235        default=False,
     236        help="Print the version number, then exit")
    219237    parser.add_option(
    220238        '-q', '--quiet',
     
    280298    global keep_tempdir
    281299    keep_tempdir = options.keep
     300
     301    if options.version:
     302        sys.stdout.write(
     303            "pyomo_install %s\n"
     304            "\n"
     305            "Copyright (2008) Sandia Corporation. Under the terms of Contract\n"
     306            "DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government\n"
     307            "retains certain rights in this software.\n"
     308            % (version_str(),) )
     309        return 0
     310
    282311    #
    283312    # Error checking
Note: See TracChangeset for help on using the changeset viewer.