Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Commit 431d35e

Browse files
authored
Merge pull request #110 from rtibblesbot/issue-106-562269
Consolidate launchpad interaction scripts into single launchpad_copy.py
2 parents 468a21e + db720a6 commit 431d35e

14 files changed

Lines changed: 895 additions & 435 deletions

.github/workflows/build_debian.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
env:
7070
LP_CREDENTIALS_FILE: /tmp/lp-creds.txt
7171
run: |
72-
python3 scripts/copy_to_other_distributions.py
72+
python3 scripts/launchpad_copy.py copy-to-series
7373
- name: Cleanup Launchpad credentials
7474
if: always()
7575
run: rm -f /tmp/lp-creds.txt
@@ -102,7 +102,7 @@ jobs:
102102
env:
103103
LP_CREDENTIALS_FILE: /tmp/lp-creds.txt
104104
run: |
105-
python3 scripts/copy_package_proposed_to_ppa.py
105+
python3 scripts/launchpad_copy.py promote
106106
- name: Cleanup Launchpad credentials
107107
if: always()
108108
run: rm -f /tmp/lp-creds.txt

.github/workflows/python_tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Python Tests
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install system dependencies
13+
run: |
14+
sudo apt-get update
15+
sudo apt-get install -y distro-info
16+
- name: Install dependencies
17+
run: |
18+
python3 -m pip install --upgrade pip
19+
pip install pytest vcrpy launchpadlib
20+
- name: Run tests
21+
run: |
22+
python3 -m pytest tests/ -v

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ repos:
1414
rev: v1.7.7
1515
hooks:
1616
- id: actionlint
17+
- repo: https://github.com/astral-sh/ruff-pre-commit
18+
rev: v0.15.2
19+
hooks:
20+
- id: ruff-check
21+
- id: ruff-format

kolibri_server_setup.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
import subprocess
55

66
import kolibri.utils.pskolibri as psutil
7-
8-
from kolibri.core.content.utils.paths import get_content_dir_path
97
from kolibri.core.utils.cache import RedisSettingsHelper
108
from kolibri.core.utils.cache import process_cache
11-
from kolibri.utils.options import update_options_file
12-
from kolibri.utils.conf import OPTIONS
139
from kolibri.utils.conf import KOLIBRI_HOME
10+
from kolibri.utils.conf import OPTIONS
11+
from kolibri.utils.options import update_options_file
1412

1513
# read the config file options
1614
port = OPTIONS["Deployment"]["HTTP_PORT"]
@@ -64,12 +62,14 @@ def set_port(port):
6462
"""
6563
update_options_file("Deployment", "HTTP_PORT", port)
6664

65+
6766
def set_zip_content_port(port):
6867
"""
6968
Modify Kolibri options to set the TCP port the hashi files will be served on
7069
"""
7170
update_options_file("Deployment", "ZIP_CONTENT_PORT", port)
7271

72+
7373
def delete_redis_cache():
7474
"""
7575
Delete previous cache in redis to reset it when the service starts.
@@ -141,7 +141,7 @@ def check_redis_service():
141141

142142
def save_nginx_conf_port(port, zip_port, listen_address="0.0.0.0", nginx_conf=None):
143143
"""
144-
Adds the port for nginx to run to an existing config file.
144+
Adds the port for nginx to run to an existing config file.
145145
"""
146146

147147
if nginx_conf is None:
@@ -210,9 +210,7 @@ def save_nginx_conf_port(port, zip_port, listen_address="0.0.0.0", nginx_conf=No
210210
help="Port to run hashi iframes used when installing/reconfiguring kolibri-server package",
211211
)
212212
args = parser.parse_args()
213-
if (
214-
args.debconfport
215-
): # To be executed only when installing/reconfiguring the Debian package
213+
if args.debconfport: # To be executed only when installing/reconfiguring the Debian package
216214
set_port(args.debconfport)
217215
if args.debconfzipport:
218216
set_zip_content_port(args.debconfzipport)

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[tool.ruff]
2+
target-version = "py310"
3+
line-length = 120
4+
5+
[tool.ruff.lint]
6+
select = ["E", "F", "I", "PLC0415"]
7+
ignore = ["E501"]
8+
9+
[tool.ruff.lint.isort]
10+
force-single-line = true
11+
12+
[tool.ruff.lint.per-file-ignores]
13+
"tests/*" = ["E501"]

scripts/copy_package_proposed_to_ppa.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)