| 1 |
#!/usar/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
# |
| 4 |
# Copyright © 2009 Germán Póo-Caamaño <gpoo@gnome.org> |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# This program is distributed in the hope that it will be useful, |
| 12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
# GNU Library General Public License for more details. |
| 15 |
# |
| 16 |
# You should have received a copy of the GNU General Public License |
| 17 |
# along with this program; if not, write to the Free Software |
| 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
| 19 |
""" |
| 20 |
Try to infer the tags according to the name of the |
| 21 |
package and version. |
| 22 |
""" |
| 23 |
|
| 24 |
import re |
| 25 |
|
| 26 |
modules = [ 'desktop', 'platform' ] |
| 27 |
|
| 28 |
# Only the first version of each stable release on the series 2.x |
| 29 |
# i.e. 2.0.0, 2.2.0, 2.14.0, etc. |
| 30 |
pattern = re.compile('^.*/(2.*[02468])/.*0/sources/(.*)$') |
| 31 |
ptag = re.compile('^(.*)-(.*).tar.gz$') |
| 32 |
|
| 33 |
def scan_file(fd): |
| 34 |
for line in fd.readlines(): |
| 35 |
m = pattern.match(line) |
| 36 |
if m: |
| 37 |
mod_version = m.group(1) |
| 38 |
package = m.group(2) |
| 39 |
m = ptag.match(package) |
| 40 |
if m: |
| 41 |
name = m.group(1) |
| 42 |
pkg_version = m.group(2) |
| 43 |
tag_1 = '%s-%s' % (name, pkg_version) |
| 44 |
tag_2 = tag_1.replace('-', '_').replace('.', '_').upper() |
| 45 |
print mod_version, name, pkg_version, tag_1, tag_2 |
| 46 |
else: |
| 47 |
print "ERROR", mod_version, package |
| 48 |
|
| 49 |
for module in modules: |
| 50 |
fd = open('data/%s.txt' % module) |
| 51 |
scan_file(fd) |
| 52 |
fd.close() |