annotate website/issues/extensions/templating.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 42ff671d7f41
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6477
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
1 import logging
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
2 logger = logging.getLogger('extension')
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
3
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
4 import sys
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
5 from roundup import __version__ as roundup_version
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
6 def AboutPage(db):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
7 "report useful info about this tracker"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
8
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
9 def is_module_loaded(module):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
10 modules = list(sys.modules.keys())
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
11 return module in modules
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
12
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
13 def get_status_of_module(module, prefix=None, version=True):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
14 modules = list(sys.modules.keys())
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
15 is_enabled = module in modules
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
16 if is_enabled:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
17 if module == 'pyme':
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
18 from pyme import version
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
19 version="version %s"%version.versionstr
6521
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
20 elif module == 'MySQLdb':
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
21 from MySQLdb import version_info
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
22 version="version %s"%".".join([str(v) for v in version_info])
6477
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
23 elif module == 'pychart':
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
24 from pychart import version
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
25 version="version %s"%version.version
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
26 elif module == 'sqlite3':
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
27 from sqlite3 import version
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
28 version="version %s"%version
6521
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
29 elif module == "whoosh":
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
30 from whoosh import versionstring
42ff671d7f41 Fix reporting of mysql and whoosh versions.
John Rouillard <rouilj@ieee.org>
parents: 6507
diff changeset
31 version="version %s"%versionstring()
6477
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
32 elif module == 'xapian':
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
33 from xapian import version_string
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
34 version="version %s"%version_string()
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
35 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
36 if version:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
37 m = __import__(module)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
38 try:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
39 version="version %s"%m.__version__
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
40 except AttributeError:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
41 version="version unavailable - exception thrown"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
42 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
43 version="version unavailable"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
44
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
45 if prefix:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
46 return "%s %s %s enabled: %s"%(prefix, module, version, is_enabled)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
47 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
48 return "Module: %s %s enabled: %s"%(module, version, is_enabled)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
49 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
50 if prefix:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
51 return "%s %s enabled: %s"%(prefix, module, is_enabled)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
52 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
53 return "Module: %s enabled: %s"%(module, is_enabled)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
54
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
55 info = []
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
56
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
57 info.append("Tracker name: %s<br>"%db.config['TRACKER_NAME'])
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
58
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
59 info.append("<h2>Operating environment</h2>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
60 info.append('<a href="http://roundup.sourceforge.net/">Roundup</a> version: %s<br>'%roundup_version)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
61 info.append("Python Version: %s<br>"%sys.version)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
62
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
63 info.append("<h2>Configuration</h2>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
64
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
65 backend = db.config['RDBMS_BACKEND']
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
66 info.append("Roundup backend: %s<br>"%backend)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
67 if backend != 'anydbm':
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
68 info.append("Roundup db cache: %s<br>"%db.config['RDBMS_CACHE_SIZE'])
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
69 info.append("Roundup isolation_level: %s<br>"%db.config['RDBMS_ISOLATION_LEVEL'])
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
70
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
71 info.append("Roundup template: %s<br>"%db.config['TEMPLATE_ENGINE'])
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
72
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
73 info.append("<h2>Database modules</h2>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
74 info.append(get_status_of_module('anydbm', version=False) + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
75 info.append(get_status_of_module('dbm', version=False) + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
76 info.append(get_status_of_module('sqlite3') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
77 info.append(get_status_of_module('MySQLdb') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
78 info.append(get_status_of_module('psycopg2') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
79
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
80 info.append("<h2>Other modules</h2>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
81
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
82 indexer = db.config['INDEXER']
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
83 if not indexer:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
84 if is_module_loaded('xapian'):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
85 indexer="unset using xapian"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
86 elif is_module_loaded('whoosh'):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
87 indexer="unset using woosh"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
88 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
89 indexer="unset using native"
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
90 else:
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
91 indexer="set to " + indexer
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
92
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
93 info.append("Indexer used for full-text: %s<br>"%indexer)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
94
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
95 info.append("Available indexers:<br><ul>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
96 if is_module_loaded('xapian'):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
97 info.append("<li>%s</li>"%get_status_of_module('xapian', prefix="Indexer loaded:"))
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
98 if is_module_loaded('whoosh'):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
99 info.append("<li>%s</li>"%get_status_of_module('whoosh', prefix="Indexer loaded:"))
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
100 info.append("<li>Indexer loaded: native: True</li>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
101 info.append("</ul>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
102 info.append(get_status_of_module('pytz') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
103 info.append(get_status_of_module('pyme') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
104 info.append(get_status_of_module('OpenSSL') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
105 info.append(get_status_of_module('pychart') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
106 info.append(get_status_of_module('pygal') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
107
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
108 info.append(get_status_of_module('jinja2') + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
109
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
110 uid = db._db.getuid()
6478
a35d4e0c4e07 Fix permissions check. Use role not perm check.
John Rouillard <rouilj@ieee.org>
parents: 6477
diff changeset
111 if uid == "1" or db._db.user.has_role(uid,"Admin"):
6477
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
112 #may leak sensitive info about system, directory paths etc.
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
113 #and keys so require admin user access. Consider expanding
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
114 #to Admin rights for tracker.
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
115 info.append("")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
116 info.append("Module Path: %r"%sys.path)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
117
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
118 info.append("<h2>Environment Variables</h2>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
119 info.append("<pre>") # include pre to prevent wrapping of values
6507
bc95f7431efb Remove miscommited issue directory; AboutPage fix; aria for drag/drop
John Rouillard <rouilj@ieee.org>
parents: 6478
diff changeset
120 for key in list(db._client.env.keys()):
6477
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
121 info.append("%s=%s"%(key,db._client.env[key]) + "<br>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
122 info.append("</pre>")
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
123 return "\n".join(info)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
124
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
125 def init(instance):
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
126 instance.registerUtil('AboutPage', AboutPage)
0ecfa817299b Added code for utils.AboutPage called from home.about.html
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
127

Roundup Issue Tracker: http://roundup-tracker.org/