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

Allow bytecode again #9502

Merged
merged 4 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*.egg
*.egg-info
*.lock
*.pyc
*.py[cod]
*.snap
*.tac
_trial_temp/
_trial_temp*/
/out
.DS_Store
__pycache__/

# stuff that is likely to exist when you run a server locally
/*.db
Expand Down
1 change: 1 addition & 0 deletions changelog.d/9502.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow python to generate bytecode for synapse.
6 changes: 3 additions & 3 deletions debian/build_virtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ trap "rm -r $tmpdir" EXIT
cp -r tests "$tmpdir"

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

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

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

# add a dependency on the right version of python to substvars.
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
matrix-synapse-py3 (1.29.0) UNRELEASED; urgency=medium

[ Jonathan de Jong ]
* Remove the python -B flag (don't generate bytecode) in scripts and documentation.

-- Synapse Packaging team <packages@matrix.org> Fri, 26 Feb 2021 14:41:31 +0100
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't exactly know how to "correctly" annotate or sign this, please suggest how i might change this to something that works better

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct to me 🙂 We'll update it with the New synapse release 1.29.0. bit during release.


matrix-synapse-py3 (1.28.0) stable; urgency=medium

* New synapse release 1.28.0.
Expand Down
2 changes: 1 addition & 1 deletion debian/synctl.1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Configuration file may be generated as follows:
.
.nf

$ python \-B \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
$ python \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name=<server name>
.
.fi
.
Expand Down
2 changes: 1 addition & 1 deletion debian/synctl.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ process.

Configuration file may be generated as follows:

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

## ENVIRONMENT

Expand Down
2 changes: 0 additions & 2 deletions synapse/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

from synapse import python_dependencies # noqa: E402

sys.dont_write_bytecode = True

logger = logging.getLogger(__name__)

try:
Expand Down
3 changes: 1 addition & 2 deletions synctl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import yaml

from synapse.config import find_config_files

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

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

args = [
sys.executable,
"-B",
"-m",
app,
"-c",
Expand Down