Skip to content

Commit

Permalink
Handle Python2+3, add natsort to dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Mar 16, 2016
1 parent cbbdff1 commit b08a823
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion UsersGuide/Makefile
Expand Up @@ -270,4 +270,4 @@ source/omchelptext.rst:
$(OPENMODELICA_ROOT)/build/bin/omc +help=omcall-sphinxoutput > "$@.tmp"
mv "$@.tmp" "$@"
source/tracreleases.inc: source/tracreleases.py
cd source && ./tracreleases.py
cd source && python ./tracreleases.py
1 change: 1 addition & 0 deletions UsersGuide/source/requirements.txt
@@ -1,5 +1,6 @@
bibtexparser
gitpython
natsort
sphinx
sphinxcontrib-bibtex
sphinxcontrib-inlinesyntaxhighlight
Expand Down
12 changes: 9 additions & 3 deletions UsersGuide/source/tracreleases.py
@@ -1,11 +1,17 @@
#!/usr/bin/env python3
# encoding=utf8

import sys

import xmlrpc.client
from subprocess import call
import natsort
import re

server = xmlrpc.client.ServerProxy("https://trac.openmodelica.org/OpenModelica/rpc")
if sys.version_info >= (3,0):
from xmlrpc.client import ServerProxy
else:
from xmlrpclib import ServerProxy
server = ServerProxy("https://trac.openmodelica.org/OpenModelica/rpc")

releases = [i for i in server.wiki.getAllPages() if i.startswith("ReleaseNotes/")]
releases = natsort.natsorted(releases)
Expand All @@ -20,7 +26,7 @@
(content,n) = re.subn(r'^([*]*) ( *[*])', r'*\1\2', content, flags=re.M)
content = re.sub(r'^([*]*) [*]', r'\1*', content)
content = re.sub(r'== Detailed Changes ==\s*\[\[TicketQuery[^]]*\]\]', '', content, re.MULTILINE)
open("tmp.wiki", "w").write(content)
open("tmp.wiki", "w").write(content.encode('utf-8'))
call(["pandoc", "--base-header-level=2", "-o", "tmp.rst", "tmp.wiki"])
contentrst = open("tmp.rst", "r").read()
# Removes {{{#!div lines; easier on the rst since it's a 1-line pattern
Expand Down

0 comments on commit b08a823

Please sign in to comment.