git_tag_packages Namespace Reference

Functions

def cmakelists (path)
 
def getSubdirVer (cmakelists)
 
def main ()
 

Variables

string __author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"
 

Function Documentation

def git_tag_packages.cmakelists (   path)
Generator yielding the paths of the requirements files in a tree.

Definition at line 11 of file git_tag_packages.py.

11 def cmakelists(path):
12  """
13  Generator yielding the paths of the requirements files in a tree.
14  """
15  for dirpath, dirnames, filenames in os.walk(path):
16  if 'CMakeLists.txt' in filenames and dirpath != path:
17  dirnames[:] = [] # no need to recurse if we have a 'CMakeLists.txt'
18  yield os.path.join(dirpath, 'CMakeLists.txt')
19  else:
20  # some directories should be ignored
21  dirnames[:] = [dirname for dirname in dirnames
22  if not dirname.startswith('build.') and
23  dirname != 'cmake']
24 
def git_tag_packages.getSubdirVer (   cmakelists)
Extract subdir name and version from a CMakeLists.txt file.

Definition at line 25 of file git_tag_packages.py.

25 def getSubdirVer(cmakelists):
26  """
27  Extract subdir name and version from a CMakeLists.txt file.
28  """
29  pattern = re.compile(r"^\s*gaudi_subdir\s*\(\s*(\S+)\s+(\S+)\s*\)\s*$")
30  for l in open(cmakelists):
31  m = pattern.match(l.strip())
32  if m:
33  return m.groups()
34  return (None, None)
35 
def getSubdirVer(cmakelists)
def git_tag_packages.main ( )

Definition at line 36 of file git_tag_packages.py.

36 def main():
37  #from optparse import OptionParser
38  root = os.path.realpath(__file__)
39  root = os.path.dirname(root)
40  root = os.path.dirname(root)
41  root = os.path.dirname(root)
42  for p, v in map(getSubdirVer, cmakelists(root)):
43  if p and v:
44  cmd = ["git", "tag", "%s/%s" % (p, v)]
45  print " ".join(cmd) + ":",
46  git = Popen(cmd, stdout=PIPE, stderr=PIPE)
47  out, err = git.communicate()
48  if git.returncode == 0:
49  print "done"
50  else:
51  print "failed"
52  elif p:
53  print "WARNING: no version in subdir", p
54  elif v:
55  print "WARNING: found CMakeLists.txt with version (%s), but no subdir name" % v
56 
struct GAUDI_API map
Parametrisation class for map-like implementation.

Variable Documentation

string git_tag_packages.__author__ = "Marco Clemencic <Marco.Clemencic@cern.ch>"

Definition at line 5 of file git_tag_packages.py.