summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas James Alexander Thurman <tthurman@src.gnome.org>2008-11-25 23:20:46 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-11-25 23:20:46 +0000
commit945c9cb8e0196f491bbfcab52bb3414037e760da (patch)
treee230712a712331ca9cc3d9ffcc54c722548c9589
parentcf2206352f5a56baf1b8d203876ceb45d1ef625e (diff)
downloadmetacity-945c9cb8e0196f491bbfcab52bb3414037e760da.tar.gz
script to produce announcements
* tools/announce-wrangler.py (added): script to produce announcements svn path=/trunk/; revision=4039
-rw-r--r--ChangeLog4
-rw-r--r--tools/announce-wrangler.py154
2 files changed, 158 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b986cd61..8f0e4cb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-11-26 Thomas Thurman <tthurman@gnome.org>
+ * tools/announce-wrangler.py (added): script to produce announcements
+
+2008-11-26 Thomas Thurman <tthurman@gnome.org>
+
* src/core/xprops.c: add casts (#562106)
2008-11-25 Thomas Thurman <tthurman@gnome.org>
diff --git a/tools/announce-wrangler.py b/tools/announce-wrangler.py
new file mode 100644
index 00000000..54b45676
--- /dev/null
+++ b/tools/announce-wrangler.py
@@ -0,0 +1,154 @@
+import commands
+import xml.dom.minidom
+import glob
+import wordpresslib # http://www.blackbirdblog.it/programmazione/progetti/28
+import ConfigParser
+import os
+
+doaps = glob.glob("*.doap")
+
+if len(doaps)==0:
+ print 'Please run this from the top-level directory.'
+
+description=str(xml.dom.minidom.parse(doaps[0]).getElementsByTagName('shortdesc')[0].firstChild.toxml().strip())
+
+program_name = doaps[0][:-5]
+print program_name
+
+markup = {
+ 'text': {
+ 'open': ' *',
+ 'newline': ' ',
+ 'close': '',
+ },
+ 'html': {
+ 'open': '<li>',
+ 'newline': '',
+ 'close': '</li>',
+ },
+}
+
+def text_list(list, type):
+ result = []
+ for entry in list:
+ result.append(markup[type]['open'])
+ for word in entry.split():
+ if len(result[-1]+word)>75:
+ result.append(markup[type]['newline'])
+ result[-1] = result[-1] + ' ' + word
+ if result[-1].strip()=='':
+ result = result[:-1]
+ result[-1] = result[-1] + markup[type]['close']
+ return '\n'.join(result)
+
+news = file('NEWS')
+news_entry = []
+header_count = 0
+
+while header_count<2:
+ line = news.readline().replace('\n', '')
+ news_entry.append(line)
+ if line.startswith('='):
+ header_count = header_count + 1
+
+news.close()
+
+version = news_entry[0]
+news_entry = news_entry[2:-2]
+
+print version
+majorminor = '.'.join(version.split('.')[:2])
+md5s = commands.getoutput('ssh master.gnome.org md5sum /ftp/pub/GNOME/sources/metacity/%s/%s-%s.tar*' % (majorminor, program_name, version)).split()
+if len(md5s)!=4:
+ print 'WARNING: There were not two known tarballs'
+
+md5_values = {}
+
+for i in range(0, len(md5s), 2):
+ a = md5s[i+1]
+ md5_values[a[a.rindex('.'):]] = md5s[i]
+
+print md5_values
+
+changes = []
+translations = ''
+
+reading_changes = False
+reading_translations = False
+for line in news_entry:
+ line = line.replace('(#', '(GNOME bug ').strip()
+ if line.startswith('-'):
+ changes.append(line[2:])
+ reading_changes = True
+ elif reading_changes:
+ if line=='':
+ reading_changes = False
+ else:
+ changes[-1] = changes[-1] + ' ' + line
+ elif line=='Translations':
+ reading_translations = True
+ elif reading_translations:
+ translations = translations + ' ' + line
+
+translations = translations[1:]
+
+text_links = []
+for i in ('.bz2', '.gz'):
+ text_links.append('%s http://download.gnome.org/sources/metacity/%s/%s-%s.tar%s' % (
+ md5_values[i], majorminor, program_name, version, i))
+
+text_version = """\
+What is it ?
+============
+%s
+
+What's changed ?
+================
+%s
+
+Translations:
+%s
+
+Where can I get it ?
+====================
+%s""" % (text_list([description], 'text'),
+ text_list(changes, 'text'),
+ text_list([translations], 'text'),
+ text_list(text_links, 'text'))
+
+print "============ x8 x8 x8 ===== SEND THIS TO gnome-announce-list"
+print text_version
+print "============ x8 x8 x8 ===== ENDS"
+
+html_version = """\
+<b>What is it ?</b><br />
+<ul>%s</ul>
+
+<b>What's changed ?</b><br />
+<ul>%s</ul>
+
+<i>Translations:</i><br />
+<ul>%s</ul>
+
+<b>Where can I get it ?</b><br />
+<ul>%s</ul>""" % (text_list([description], 'html'),
+ text_list(changes, 'html'),
+ text_list([translations], 'html'),
+ text_list(text_links, 'html'))
+
+cp = ConfigParser.ConfigParser()
+cp.read(os.environ['HOME']+'/.config/release-wrangler.ini')
+
+wp = wordpresslib.WordPressClient(
+ cp.get('release-wrangler', 'blogurl'),
+ cp.get('release-wrangler', 'bloguser'),
+ cp.get('release-wrangler', 'blogpass'))
+wp.selectBlog(cp.getint('release-wrangler', 'blognumber'))
+post = wordpresslib.WordPressPost()
+post.title = '%s %s released' % (program_name, version)
+post.description = html_version
+# appears to have been turned off-- ask jdub
+#idPost = wp.newPost(post, False)
+
+print html_version
+