Mercurial > p > roundup > code
annotate roundup/dist/command/bdist_rpm.py @ 6747:d32d43e4a5ba
wsgi can cache tracker instance enabled by feature flag.
Patch by Marcus Priesch caches a loaded tracker instance and reuse it
for future client sessions.
It is enabled by a feature flag in wsgi.py since it arrived during the
2.2.0 beta period.
The provided wsgi.py is modified to enable it. Testing is run with
flag enabled and disabled.
Ralf Schlatterbeck and Marcus tested it on one of their larger more
complex trackers and it sped up the response time to a client request
by a factor of 3 (270ms down to about 80-85ms).
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 02 Jul 2022 14:04:00 -0400 |
| parents | 42bf0a707763 |
| children | 551fec9c4cfc |
| rev | line source |
|---|---|
| 4068 | 1 # |
| 2 # Copyright (C) 2009 Stefan Seefeld | |
| 3 # All rights reserved. | |
| 4 # For license terms see the file COPYING.txt. | |
| 5 # | |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
6 # converted to not use distutils 2021 |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
7 from setuptools.command.bdist_rpm import bdist_rpm as base |
| 4068 | 8 import os |
| 9 | |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
10 # cribbed from 2.7 distutils |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
11 def write_file (filename, contents): |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
12 """Create a file with the specified name and write 'contents' (a |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
13 sequence of strings without line terminators) to it. |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
14 """ |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
15 f = open(filename, "w") |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
16 try: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
17 for line in contents: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
18 f.write(line + "\n") |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
19 finally: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
20 f.close() |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
21 |
| 4068 | 22 class bdist_rpm(base): |
| 23 | |
| 24 def finalize_options(self): | |
| 25 base.finalize_options(self) | |
| 26 if self.install_script: | |
| 27 # install script is overridden. skip default | |
| 28 return | |
| 29 # install script option must be file name. | |
| 30 # create the file in rpm build directory. | |
| 31 install_script = os.path.join(self.rpm_base, "install.sh") | |
| 32 self.mkpath(self.rpm_base) | |
| 33 self.execute(write_file, (install_script, [ | |
| 34 ("%s setup.py install --root=$RPM_BUILD_ROOT " | |
| 35 "--record=ROUNDUP_FILES") % self.python, | |
| 36 # allow any additional extension for man pages | |
| 37 # (rpm may compress them to .gz or .bz2) | |
| 38 # man page here is any file | |
| 39 # with single-character extension | |
| 40 # in man directory | |
| 41 "sed -e 's,\(/man/.*\..\)$,\\1*,' " | |
| 42 "<ROUNDUP_FILES >INSTALLED_FILES", | |
| 43 ]), "writing '%s'" % install_script) | |
| 44 self.install_script = install_script | |
| 45 |
