164 logging.basicConfig(level=logging.DEBUG)
166 os.chdir(os.path.dirname(os.path.dirname(__file__)))
169 for l
in open(
'toolchain.cmake'):
170 m = re.match(
r'^\s*set\(\s*heptools_version\s+(\S*)\s*\)', l)
172 HEPToolsVers = m.group(1)
173 print "Using HEPTools", HEPToolsVers
176 logging.error(
'Cannot find HEPTools version')
181 for dirpath, dirnames, filenames
in os.walk(os.curdir):
182 if 'CMakeLists.txt' in filenames
and dirpath != os.curdir:
186 dirnames[:] = [dirname
for dirname
in dirnames
187 if not dirname.startswith(
'build.')
and
191 special_subdirs = [
"Gaudi",
"GaudiExamples",
"GaudiSys",
"GaudiRelease"]
196 old_version = latest_tag.split(
'_')[-1]
197 new_version = raw_input(
"The old version of the project is %s, which is the new one? " % old_version)
203 for pkgdir
in all_subdirs():
204 cmlfile = os.path.join(pkgdir,
'CMakeLists.txt')
205 reqfile = os.path.join(pkgdir,
'cmt',
'requirements')
207 pkg = os.path.basename(pkgdir)
211 if pkg
in special_subdirs:
214 git_log = Popen([
'git',
'log',
'-m',
'--first-parent',
215 '--stat', latest_tag +
'..master', pkgdir],
216 stdout=PIPE).communicate()[0].strip()
218 msg = (
'\nThe old version of {0} is {1}, these are the changes:\n'
220 'Which version you want (old is {1})? ').
format(pkg,
223 vers = raw_input(msg)
224 while not vers
or vers == old_vers:
225 vers = raw_input(
'give me a version')
231 new_versions[pkg] = vers
or old_vers
235 reqfile = os.path.join(
'GaudiRelease',
'cmt',
'requirements')
237 for l
in open(reqfile):
238 sl = l.strip().split()
239 if sl
and sl[0] ==
"use":
240 if sl[1]
in new_versions:
241 if sl[2] != new_versions[sl[1]]:
242 l = l.replace(sl[2], new_versions[sl[1]])
244 open(reqfile,
"w").writelines(out)
246 config = ConfigParser.ConfigParser()
247 config.optionxform = str
248 if os.path.exists(
'project.info'):
249 config.read(
'project.info')
250 if not config.has_section(
'Packages'):
251 config.add_section(
'Packages')
252 for pack_vers
in sorted(new_versions.items()):
253 config.set(
'Packages', *pack_vers)
254 config.write(open(
'project.info',
'wb'))
258 for l
in open(
'CMakeLists.txt'):
259 if l.strip().startswith(
'gaudi_project'):
260 l =
'gaudi_project(Gaudi %s)\n' % new_version
262 open(
'CMakeLists.txt',
"w").writelines(out)
def updateReleaseNotes(path, notes)
def extract_version(path)
def change_version(packagedir, newversion)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".