Changeset 9697


Ignore:
Timestamp:
Feb 26, 2015, 2:37:54 PM (9 years ago)
Author:
steve
Message:

adding fiules to deal with revision numbers

Location:
trunk/anuga_core
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/abstract_2d_finite_volumes/util.py

    r9615 r9697  
    2222# FIXME (Ole): remove and update scripts where they are used
    2323from anuga.utilities.system_tools import get_revision_number
    24 from anuga.utilities.system_tools import store_version_info
     24from anuga.utilities.system_tools import store_revision_info
    2525
    2626import anuga.utilities.log as log
  • trunk/anuga_core/anuga/config.py

    r9693 r9697  
    1010################################################################################
    1111
    12 epsilon = 1.0e-12                    # Smallest number - used for safe division
    13 max_float = 1.0e36                   # Largest number - used to initialise
    14                                      # (max, min) ranges
    15 default_smoothing_parameter = 0.001  # Default alpha for penalised
    16                                      # least squares fitting
    17 single_precision = 1.0e-6            # Smallest single precision number
    18 velocity_protection = 1.0e-6         # Used to compute velocity from momentum
    19                                      # See section 7.4 on Flux limiting
    20                                      # in the user manual
     12epsilon = 1.0e-12                   # Smallest number - used for safe division
     13max_float = 1.0e36                  # Largest number - used to initialise
     14                                    # (max, min) ranges
     15default_smoothing_parameter = 0.001 # Default alpha for penalised
     16                                    # least squares fitting
     17single_precision = 1.0e-6           # Smallest single precision number
     18velocity_protection = 1.0e-6        # Used to compute velocity from momentum
     19                                    # See section 7.4 on Flux limiting
     20                                    # in the user manual
    2121                           
    2222
     
    2626
    2727pmesh_filename = '.\\pmesh'
    28 #version_filename = 'stored_version_info.py'
     28revision_filename = 'revision.py'
    2929default_datadir = '.'
    3030time_format = '%d/%m/%y %H:%M:%S'    # Used with timefile2netcdf
  • trunk/anuga_core/anuga/utilities/system_tools.py

    r9677 r9697  
    1919    import md5 as hashlib
    2020
    21 import anuga.utilities.log as log
    22 
    2321
    2422def log_to_file(filename, s, verbose=False, mode='a'):
     
    9694        # so will need a better way to get revision number
    9795       
    98         from anuga.utilities.stored_version_info import version_info
    99         return process_version_info(version_info)
     96        from anuga.revision import revision_info
     97        return process_revision_info(revision_info)
    10098
    10199    line = fd.readlines()[3]
     
    196194    """Get the (svn) revision number of this repository copy.
    197195    """
    198 
    199     from anuga import __svn_revision__ as revision
    200     return revision
    201            
    202 
    203 def process_version_info(version_info):
     196    from  anuga.revision import revision_info
     197    return process_revision_info(revision_info)
     198
     199
     200def process_revision_info(revision_info):
    204201
    205202    # split revision number from data
    206     for line in version_info.split('\n'):
     203    for line in revision_info.split('\n'):
    207204        if line.startswith('Revision:'):
    208205            break
    209206
    210207    fields = line.split(':')
    211     msg = 'Keyword "Revision" was not found anywhere in text: %s' % version_info
     208    msg = 'Keyword "Revision" was not found anywhere in text: %s' % revision_info
    212209    assert fields[0].startswith('Revision'), msg
    213210
     
    222219    return revision_number
    223220
    224 def store_version_info(destination_path='.', verbose=False):
    225     """Obtain current version from Subversion and store it.
     221def store_revision_info(destination_path='.', verbose=False):
     222    """Obtain current revision from Subversion and store it.
    226223   
    227224    Title: store_version_info()
     
    256253        txt = subprocess.Popen('svn info', shell=True, stdout=subprocess.PIPE).communicate()[0]
    257254    except:
    258         msg = 'Command "svn" is not recognised on the system PATH'
    259         raise Exception(msg)
     255        txt = 'Revision: 0'
    260256    else:   
    261257        #txt = fid.read()
     
    269265            destination_path += os.sep
    270266           
    271         filename = destination_path + config.version_filename
     267        filename = destination_path + config.revision_filename
    272268
    273269        fid = open(filename, 'w')
    274270
    275         docstring = 'Stored version info.\n\n'
     271        docstring = 'Stored revision info.\n\n'
    276272        docstring += 'This file provides the version for distributions '
    277273        docstring += 'that are not accessing Subversion directly.\n'
     
    280276        fid.write('"""%s"""\n\n' %docstring)
    281277       
    282         fid.write('version_info = """\n%s"""' %txt)
     278        fid.write('revision_info = """\n%s"""' %txt)
    283279        fid.close()
    284280
    285281
    286282        if verbose is True:
    287             log.critical('Version info stored to %s' % filename)
     283            print 'Revision info stored to %s' % filename
    288284
    289285
  • trunk/anuga_core/setup.py

    r9688 r9697  
    124124
    125125def setup_package():
     126   
     127    from anuga.utilities.system_tools import store_revision_info
     128   
     129    store_revision_info(destination_path='anuga')
     130   
    126131    metadata = dict(name=DISTNAME,
    127132                    maintainer=MAINTAINER,
     
    150155                    **extra_setuptools_args)
    151156
    152 #     if (len(sys.argv) >= 2
    153 #             and ('--help' in sys.argv[1:] or sys.argv[1]
    154 #                  in ('--help-commands', 'egg_info', '--version', 'clean'))):
    155 #
    156 #         # For these actions, NumPy is not required.
    157 #         #
    158 #         # They are required to succeed without Numpy for example when
    159 #         # pip is used to install anuga when Numpy is not yet present in
    160 #         # the system.
    161 #         try:
    162 #             from setuptools import setup
    163 #         except ImportError:
    164 #             from distutils.core import setup
    165 #
    166 #         metadata['version'] = VERSION
    167 #     else:
    168 #         from numpy.distutils.core import setup
    169 #
    170 #         metadata['configuration'] = configuration
    171        
    172157
    173158
Note: See TracChangeset for help on using the changeset viewer.