Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit e12077a

Browse files
Allow bytecode again (#9502)
In #75, bytecode was disabled (from a bit of FUD back in `python<2.4` days, according to dev chat), I think it's safe enough to enable it again. Added in `__pycache__/` and `.pyc`/`.pyd` to `.gitignore`, to extra-insure compiled files don't get committed. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
1 parent ddb2402 commit e12077a

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
*.egg
77
*.egg-info
88
*.lock
9-
*.pyc
9+
*.py[cod]
1010
*.snap
1111
*.tac
1212
_trial_temp/
1313
_trial_temp*/
1414
/out
1515
.DS_Store
16+
__pycache__/
1617

1718
# stuff that is likely to exist when you run a server locally
1819
/*.db

changelog.d/9502.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow python to generate bytecode for synapse.

debian/build_virtualenv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ trap "rm -r $tmpdir" EXIT
5858
cp -r tests "$tmpdir"
5959

6060
PYTHONPATH="$tmpdir" \
61-
"${TARGET_PYTHON}" -B -m twisted.trial --reporter=text -j2 tests
61+
"${TARGET_PYTHON}" -m twisted.trial --reporter=text -j2 tests
6262

6363
# build the config file
64-
"${TARGET_PYTHON}" -B "${VIRTUALENV_DIR}/bin/generate_config" \
64+
"${TARGET_PYTHON}" "${VIRTUALENV_DIR}/bin/generate_config" \
6565
--config-dir="/etc/matrix-synapse" \
6666
--data-dir="/var/lib/matrix-synapse" |
6767
perl -pe '
@@ -87,7 +87,7 @@ PYTHONPATH="$tmpdir" \
8787
' > "${PACKAGE_BUILD_DIR}/etc/matrix-synapse/homeserver.yaml"
8888

8989
# build the log config file
90-
"${TARGET_PYTHON}" -B "${VIRTUALENV_DIR}/bin/generate_log_config" \
90+
"${TARGET_PYTHON}" "${VIRTUALENV_DIR}/bin/generate_log_config" \
9191
--output-file="${PACKAGE_BUILD_DIR}/etc/matrix-synapse/log.yaml"
9292

9393
# add a dependency on the right version of python to substvars.

debian/changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
matrix-synapse-py3 (1.29.0) UNRELEASED; urgency=medium
2+
3+
[ Jonathan de Jong ]
4+
* Remove the python -B flag (don't generate bytecode) in scripts and documentation.
5+
6+
-- Synapse Packaging team <packages@matrix.org> Fri, 26 Feb 2021 14:41:31 +0100
7+
18
matrix-synapse-py3 (1.28.0) stable; urgency=medium
29

310
* New synapse release 1.28.0.

debian/synctl.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Configuration file may be generated as follows:
4444
.
4545
.nf
4646

47-
$ python \-B \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
47+
$ python \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
4848
.
4949
.fi
5050
.

debian/synctl.ronn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ process.
4141

4242
Configuration file may be generated as follows:
4343

44-
$ python -B -m synapse.app.homeserver -c config.yaml --generate-config --server-name=<server name>
44+
$ python -m synapse.app.homeserver -c config.yaml --generate-config --server-name=<server name>
4545

4646
## ENVIRONMENT
4747

synapse/app/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
from synapse import python_dependencies # noqa: E402
1919

20-
sys.dont_write_bytecode = True
21-
2220
logger = logging.getLogger(__name__)
2321

2422
try:

synctl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import yaml
3030

3131
from synapse.config import find_config_files
3232

33-
SYNAPSE = [sys.executable, "-B", "-m", "synapse.app.homeserver"]
33+
SYNAPSE = [sys.executable, "-m", "synapse.app.homeserver"]
3434

3535
GREEN = "\x1b[1;32m"
3636
YELLOW = "\x1b[1;33m"
@@ -117,7 +117,6 @@ def start_worker(app: str, configfile: str, worker_configfile: str) -> bool:
117117

118118
args = [
119119
sys.executable,
120-
"-B",
121120
"-m",
122121
app,
123122
"-c",

0 commit comments

Comments
 (0)