All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
git_tag_packages Namespace Reference

Functions

def cmakelists
 
def getSubdirVer
 
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 
12 def cmakelists(path):
13  """
14  Generator yielding the paths of the requirements files in a tree.
15  """
16  for dirpath, dirnames, filenames in os.walk(path):
17  if 'CMakeLists.txt' in filenames and dirpath != path:
18  dirnames[:] = [] # no need to recurse if we have a 'CMakeLists.txt'
19  yield os.path.join(dirpath, 'CMakeLists.txt')
20  else:
21  # some directories should be ignored
22  dirnames[:] = [dirname for dirname in dirnames
23  if not dirname.startswith('build.') and
24  dirname != 'cmake']
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 
26 def getSubdirVer(cmakelists):
27  """
28  Extract subdir name and version from a CMakeLists.txt file.
29  """
30  pattern = re.compile(r"^\s*gaudi_subdir\s*\(\s*(\S+)\s+(\S+)\s*\)\s*$")
31  for l in open(cmakelists):
32  m = pattern.match(l.strip())
33  if m:
34  return m.groups()
35  return (None, None)
def git_tag_packages.main ( )

Definition at line 36 of file git_tag_packages.py.

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