Browse Source

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>`
tags/v1.29.0rc1
Jonathan de Jong 3 years ago
committed by GitHub
parent
commit
e12077a78a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 10 deletions
  1. +2
    -1
      .gitignore
  2. +1
    -0
      changelog.d/9502.misc
  3. +3
    -3
      debian/build_virtualenv
  4. +7
    -0
      debian/changelog
  5. +1
    -1
      debian/synctl.1
  6. +1
    -1
      debian/synctl.ronn
  7. +0
    -2
      synapse/app/__init__.py
  8. +1
    -2
      synctl

+ 2
- 1
.gitignore View File

@@ -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


+ 1
- 0
changelog.d/9502.misc View File

@@ -0,0 +1 @@
Allow python to generate bytecode for synapse.

+ 3
- 3
debian/build_virtualenv View File

@@ -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 '
@@ -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.


+ 7
- 0
debian/changelog View File

@@ -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

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

* New synapse release 1.28.0.


+ 1
- 1
debian/synctl.1 View File

@@ -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
.


+ 1
- 1
debian/synctl.ronn View File

@@ -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



+ 0
- 2
synapse/app/__init__.py View File

@@ -17,8 +17,6 @@ import sys

from synapse import python_dependencies # noqa: E402

sys.dont_write_bytecode = True

logger = logging.getLogger(__name__)

try:


+ 1
- 2
synctl View File

@@ -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"
@@ -117,7 +117,6 @@ def start_worker(app: str, configfile: str, worker_configfile: str) -> bool:

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


Loading…
Cancel
Save