Mercurial > p > roundup > code
view website/issues/extensions/local_replace.py @ 8044:f9eaaa63fda2
build: update website build to sync built files
Sourceforge only supports python 2.7. Newer version of sphinx are
required to build docs and they don't work with 2.7.
Set up rsync targets that:
1) copy html build directory to sourceforge target directory
(dev_docs, production and user home directory)
2) backup existing sourceforge target directory re-sync so it
can be served without any missing files.
The Makefile now check to see if .orig or *~ files are present in the
html build tree. It lists the garbage file and fails if so.
Also inserts a .htaccess into the tree to prevent access to:
.buildinfo file
docs_backup-* files
*.orig
*~
The first one is a build artifact from newer version of sphinx.
The second is the backup directory created with all the original files
before a rsync from the local system is done to sourceforge. The backup
directory is timestamped with the time of its sync.
The last two are probably redundant since make html will fail if they
exist.
To rollback a sync:
move the target directory to a new name.
move the backup directory (in the renamed target directory) to the
old target directory name.
I added the --delete flag to remove files missing from the html
directory. Using the -no-times flags will create all new files with
the current directory. Using the --backup, --backup-dir flags backs up
all replaced/deleted files to backup-dir. The --exclude flag preserves
the backup directories on the sourceforge side. Without --exclude the
-delete flag would remove these backup-dir's. Note that
--delete-exclude must not be used otherwise the backup directories
will be deleted.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 26 Jun 2024 19:11:35 -0400 |
| parents | ca62a7cc3c9b |
| children | 9c3ec0a5c7fc |
line wrap: on
line source
from __future__ import print_function import re hg_url_base = r'http://sourceforge.net/p/roundup/code/ci/' substitutions = [ (re.compile(r'debian:\#(?P<id>\d+)'), r'<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\g<id>">debian#\g<id></a>' ), (re.compile(r'\#(?P<ws>\s*)(?P<id>\d+)'), r"<a href='issue\g<id>'>#\g<ws>\g<id></a>" ), (re.compile(r'(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'), r"\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ), # matching the typical number:hash format of hg's own output # and then use use hash instead of the number (re.compile(r'(?P<prews>(^|\s+))(?P<revstr>(rev\s*|hg\s*|changeset: ))(?P<revnumber>\d+):(?P<refhash>[0-9a-fA-F]{12,40})(?P<post>\W+|$)'), r'\g<prews><a href="' + hg_url_base + '\g<refhash>">\g<revstr>\g<revnumber>:\g<refhash></a>\g<post>'), # matching hg revison number or hash (re.compile(r'(?P<prews>(^|\s+))(?P<revstr>(revision|rev|r)\s?)(?P<revision>([1-9][0-9]*)|[0-9a-fA-F]{4,40})(?P<post>\W+|$)'), r'\g<prews><a href="' + hg_url_base + '\g<revision>">\g<revstr>\g<revision></a>\g<post>'), ] def local_replace(message): for cre, replacement in substitutions: message = cre.sub(replacement, message) return message def init(instance): instance.registerUtil('localReplace', local_replace) def quicktest(msgstr, should_replace = True, substr = True): testcount['run'] += 1 replacedstr = local_replace(msgstr) if not (not replacedstr == msgstr ) == should_replace: print("(fail)", end=' ') testcount['failed'] += 1 elif substr and (msgstr not in replacedstr): print("(fail)", end=' ') testcount['failed'] += 1 if replacedstr == msgstr: print( "'%s'" % (msgstr,)) else: print("'%s' -> '%s'" % (msgstr, replacedstr)) if "__main__" == __name__: testcount = {'run':0 , 'failed': 0} print("Replacement examples:") quicktest(" debian:#222", substr=False) quicktest(" #555", substr=False) quicktest("issue333") quicktest(" revision 222", substr=False) quicktest(" r 222", substr=False) quicktest(" wordthatendswithr 222", False) quicktest(" references", False) quicktest(" too many spaces r 222", False) quicktest("re-evaluate", False) quicktest("rex140eb", False) quicktest("rev 012", False) # too short for a hg hash quicktest("rev 0123") quicktest("re140eb") quicktest(" r7140eb", substr=False) quicktest(" rev7140eb ", substr=False) quicktest("rev7140eb") quicktest("rev7140eb,", substr=False) quicktest("rev4891:ad3d628e73f2") quicktest("hg4891:ad3d628e73f2") quicktest("changeset: 4542:46239c21a1eb") quicktest("rev 4542:46239c21a1eb") quicktest("rev 4542:46239c21a1eb") # many spaces print() print(testcount)
