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

Functions

def requirements
 
def getPackVer
 
def main
 

Variables

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

Function Documentation

def git_tag_packages.getPackVer (   requirements)
Extract package name and package version from a requirements file.

Definition at line 20 of file git_tag_packages.py.

20 
21 def getPackVer(requirements):
22  """
23  Extract package name and package version from a requirements file.
24  """
25  pattern = re.compile(r"^\s*(version|package)\s*(\S+)\s*$")
26  data = dict([m.groups()
27  for m in map(pattern.match, open(requirements))
28  if m])
29  return data.get("package", None), data.get("version", None)
struct GAUDI_API map
Parametrisation class for map-like implementation.
def git_tag_packages.main ( )

Definition at line 30 of file git_tag_packages.py.

30 
31 def main():
32  #from optparse import OptionParser
33  root = os.path.realpath(__file__)
34  root = os.path.dirname(root)
35  root = os.path.dirname(root)
36  root = os.path.dirname(root)
37  for p, v in map(getPackVer, requirements(root)):
38  if p and v:
39  cmd = ["git", "tag", "%s/%s" % (p, v)]
40  print " ".join(cmd) + ":",
41  git = Popen(cmd, stdout=PIPE, stderr=PIPE)
42  out, err = git .communicate()
43  if git.returncode == 0:
44  print "done"
45  else:
46  print "failed"
47  elif p:
48  print "WARNING: no version in package", p
49  elif v:
50  print "WARNING: found requirements with version (%s), but no package" % v
struct GAUDI_API map
Parametrisation class for map-like implementation.
def git_tag_packages.requirements (   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 requirements(path):
13  """
14  Generator yielding the paths of the requirements files in a tree.
15  """
16  for root, dirs, files in os.walk(path):
17  if "requirements" in files:
18  dirs[:] = [] # no need to recurse if we have a 'requirements'
19  yield os.path.join(root, "requirements")

Variable Documentation

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

Definition at line 5 of file git_tag_packages.py.