File:  [CENS] / python / pyGiNaC / tools / get_revision.py
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Sat Apr 21 15:46:35 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
3rd way: Impl. ex methods, tests.

#!/usr/bin/env python
"""

Calculate cumulative version from Revision strings.
To be executed only from ../setup.py.

This file is part of the PyGiNaC package.
http://cens.ioc.ee/projects/pyginac/

Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>          
Permission to use, modify, and distribute this software is given under the
terms of the LGPL.  See http://www.fsf.org

NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
$Revision: 1.3 $ 
$Id: get_revision.py,v 1.3 2001-04-21 15:46:35 pearu Exp $
Pearu Peterson
"""

import os,fileinput,re

files=[]
for d in [wrapper_dir,lib_dir]:
    for f in os.listdir(d):
        if f[-3:]=='.py' or f[-2:]=='.c' or f[-4:] in ['.cpp','.hpp']:
            fn = os.path.join(d,f)
            if os.path.exists(fn): files.append(fn)
            else: print 'File "%s" does not exists. Skipping.'%(fn)

revision_version = 0
if files:
    for l in fileinput.input(files):
        m = re.match(r'.*?\$Re[v]ision:\s*\d+[.](?P<rev>\d+)\s*\$',l)
        if m:
            revision_version+=eval(m.group('rev'))
            fileinput.nextfile()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>