167 logging.basicConfig(level=logging.DEBUG)
168 os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
170 for l
in open(
'toolchain.cmake'):
171 m = re.match(
r'^\s*set\(\s*heptools_version\s+(\S*)\s*\)', l)
173 HEPToolsVers = m.group(1)
174 print "Using HEPTools", HEPToolsVers
177 logging.error(
'Cannot find HEPTools version')
182 for dirpath, dirnames, filenames
in os.walk(os.curdir):
183 if 'CMakeLists.txt' in filenames
and dirpath != os.curdir:
187 dirnames[:] = [dirname
for dirname
in dirnames
188 if not dirname.startswith(
'build.')
and
192 special_subdirs = [
"Gaudi",
"GaudiExamples",
"GaudiSys",
"GaudiRelease"]
197 old_version = latest_tag.split(
'_')[-1]
198 new_version = raw_input(
"The old version of the project is %s, which is the new one? " % old_version)
204 for pkgdir
in all_subdirs():
205 cmlfile = os.path.join(pkgdir,
'CMakeLists.txt')
206 reqfile = os.path.join(pkgdir,
'cmt',
'requirements')
208 pkg = os.path.basename(pkgdir)
212 if pkg
in special_subdirs:
215 git_log = Popen([
'git',
'log',
'-m',
'--first-parent',
216 '--stat', latest_tag +
'..master', pkgdir],
217 stdout=PIPE).communicate()[0].strip()
219 msg = (
'\nThe old version of {0} is {1}, these are the changes:\n'
221 'Which version you want (old is {1})? ').
format(pkg,
224 vers = raw_input(msg)
225 while not vers
or vers == old_vers:
226 vers = raw_input(
'give me a version, please. ')
232 new_versions[pkg] = vers
or old_vers
236 reqfile = os.path.join(
'GaudiRelease',
'cmt',
'requirements')
238 for l
in open(reqfile):
239 sl = l.strip().split()
240 if sl
and sl[0] ==
"use":
241 if sl[1]
in new_versions:
242 if sl[2] != new_versions[sl[1]]:
243 l = l.replace(sl[2], new_versions[sl[1]])
245 open(reqfile,
"w").writelines(out)
247 config = ConfigParser.ConfigParser()
248 config.optionxform = str
249 if os.path.exists(
'project.info'):
250 config.read(
'project.info')
251 if not config.has_section(
'Packages'):
252 config.add_section(
'Packages')
253 for pack_vers
in sorted(new_versions.items()):
254 config.set(
'Packages', *pack_vers)
255 config.write(open(
'project.info',
'wb'))
259 for l
in open(
'CMakeLists.txt'):
260 if l.strip().startswith(
'gaudi_project'):
261 l =
'gaudi_project(Gaudi %s)\n' % new_version
263 open(
'CMakeLists.txt',
"w").writelines(out)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
def updateReleaseNotes(path, notes)
def extract_version(path)
def change_version(packagedir, newversion)