Skip to content

Commit

Permalink
Rename python files to end in .py
Browse files Browse the repository at this point in the history
So they will get picked up by all of our linters. And remove *.py
from .flake8 because it's implied.

Fixes #1003.
  • Loading branch information
micahflee authored and legoktm committed May 7, 2024
1 parent 43dd092 commit fe8af6e
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 33 deletions.
7 changes: 0 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@
ignore = E203,W503
max-line-length = 100
extend-exclude = .venv
filename =
*.py
dom0/remove-tags
files/sdw-login
files/sdw-updater
scripts/configure-environment
scripts/destroy-vm
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include dom0/*.top
include dom0/*.j2
include dom0/*.yml
include dom0/*.conf
include dom0/remove-tags
include dom0/remove-tags.py
include dom0/securedrop-handle-upgrade
include dom0/update-xfce-settings
include README.md
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all: assert-dom0
@false

dev staging: assert-dom0 ## Configures and builds a dev or staging environment
./scripts/configure-environment --env $@
./scripts/configure-environment.py --env $@
$(MAKE) validate
$(MAKE) prep-dev
sdw-admin --apply
Expand Down Expand Up @@ -105,26 +105,26 @@ prep-dev: assert-dom0 ## Configures Salt layout for SD workstation VMs
@./files/validate_config.py

remove-sd-whonix: assert-dom0 ## Destroys SD Whonix VM
@./scripts/destroy-vm sd-whonix
@./scripts/destroy-vm.py sd-whonix

remove-sd-viewer: assert-dom0 ## Destroys SD Submission reading VM
@./scripts/destroy-vm sd-viewer
@./scripts/destroy-vm.py sd-viewer

remove-sd-proxy: assert-dom0 ## Destroys SD Proxy VM
@./scripts/destroy-vm sd-proxy
@./scripts/destroy-vm.py sd-proxy

remove-sd-app: assert-dom0 ## Destroys SD APP VM
@./scripts/destroy-vm sd-app
@./scripts/destroy-vm.py sd-app

remove-sd-gpg: assert-dom0 ## Destroys SD GPG keystore VM
@./scripts/destroy-vm sd-gpg
@./scripts/destroy-vm.py sd-gpg

remove-sd-devices: assert-dom0 ## Destroys SD EXPORT VMs
@./scripts/destroy-vm sd-devices
@./scripts/destroy-vm sd-devices-dvm
@./scripts/destroy-vm.py sd-devices
@./scripts/destroy-vm.py sd-devices-dvm

remove-sd-log: assert-dom0 ## Destroys SD logging VM
@./scripts/destroy-vm sd-log
@./scripts/destroy-vm.py sd-log

clean: assert-dom0 prep-dev ## Destroys all SD VMs
# Use the local script path, since system PATH location will be absent
Expand Down Expand Up @@ -159,7 +159,7 @@ prep-dom0: prep-dev # Copies dom0 config files
sudo qubesctl --show-output --targets dom0 state.highstate

destroy-all: ## Destroys all VMs managed by Workstation salt config
./scripts/destroy-vm --all
./scripts/destroy-vm.py --all

.PHONY: update-pip-requirements
update-pip-requirements: ## Updates all Python requirements files via pip-compile.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Qubes uses SaltStack internally for VM provisionining and configuration manageme
- Within `sd-app`, the *SecureDrop Client* will open all submissions in the `sd-viewer` disposable VM.
- `files/config.json.example` is an example config file for the provisioning process. Before use, you should copy it to `config.json` (in the repository's root directory), and adjust to reflect your environment.
- `sd-journalist.sec.example` is an example GPG private key for use in decrypting submissions. It must match the public key set on a SecureDrop server used for testing. Before use, you should copy it to `sd-journalist.sec`, or store the submission key used with your SecureDrop server as `sd-journalist.sec`.
- `launcher/` contains the pre-flight updater component (`sdw-launcher`), which updates all TemplateVMs relevant to the SecureDrop Workstation prior to use, as well as the `sdw-notify` script, which reminds the user to update the system if they have not done so recently.
- `launcher/` contains the pre-flight updater component (`sdw-launcher`), which updates all TemplateVMs relevant to the SecureDrop Workstation prior to use, as well as the `sdw-notify.py` script, which reminds the user to update the system if they have not done so recently.

## Installation

Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions files/destroy-vm → files/destroy-vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--all", default=False, required=False, action="store_true", help="Destroys all SDW VMs",
"--all",
default=False,
required=False,
action="store_true",
help="Destroys all SDW VMs",
)
parser.add_argument(
"targets", help="List of SDW VMs to destroy", nargs=argparse.REMAINDER,
"targets",
help="List of SDW VMs to destroy",
nargs=argparse.REMAINDER,
)
args = parser.parse_args()
if not args.all and len(args.targets) < 1:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ Because `securedrop-updater` is used exclusively with Fedora 32 (see above), it

After installing the development dependencies:

1. You can run the updater: `PYTHONPATH=..:$PYTHONPATH ../files/sdw-updater` (it won't actually update VMs unless you are in `dom0`)
2. You can also run the notifier: `PYTHONPATH=..:$PYTHONPATH ../files/sdw-notify`
1. You can run the updater: `PYTHONPATH=..:$PYTHONPATH ../files/sdw-updater.py` (it won't actually update VMs unless you are in `dom0`)
2. You can also run the notifier: `PYTHONPATH=..:$PYTHONPATH ../files/sdw-notify.py`
3. And, finally, tests and linters by running: `make check`.

For more `make` targets, please refer to `make help`.
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ ignore_missing_imports = true
scripts_are_modules = true
files = [
"*.py",
"dom0/remove-tags",
"dom0/remove-tags.py",
"dom0/securedrop-login",
"scripts/*.py",
"files/*.py",
"scripts/configure-environment",
"files/destroy-vm",
]
exclude = [
"launcher/", # Moving to sd-updater
"tests/"
"launcher/", # Moving to sd-updater
"tests/",
]

[tool.isort]
Expand Down
10 changes: 5 additions & 5 deletions rpm-build/SPECS/securedrop-workstation-dom0-config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ install -m 644 dom0/*.top %{buildroot}/srv/salt/
install -m 644 dom0/*.j2 %{buildroot}/srv/salt/
install -m 644 dom0/*.yml %{buildroot}/srv/salt/
install -m 644 dom0/*.conf %{buildroot}/srv/salt/
install -m 755 dom0/remove-tags %{buildroot}/srv/salt/
install -m 755 dom0/remove-tags.py %{buildroot}/srv/salt/remove-tags
install -m 755 dom0/securedrop-handle-upgrade %{buildroot}/srv/salt/
install -m 755 dom0/update-xfce-settings %{buildroot}/srv/salt/
install -m 644 sd-app/* %{buildroot}/srv/salt/sd/sd-app/
Expand All @@ -84,7 +84,7 @@ install -m 644 sd-workstation/* %{buildroot}/srv/salt/sd/sd-workstation/
install -m 755 usb-autoattach/sd-attach-export-device %{buildroot}/srv/salt/sd/usb-autoattach/
install -m 644 usb-autoattach/99-sd-devices.rules %{buildroot}/srv/salt/sd/usb-autoattach/
install -m 755 files/clean-salt %{buildroot}/%{_datadir}/%{name}/scripts/
install -m 755 files/destroy-vm %{buildroot}/%{_datadir}/%{name}/scripts/
install -m 755 files/destroy-vm.py %{buildroot}/%{_datadir}/%{name}/scripts/destroy-vm
install -m 755 files/provision-all %{buildroot}/%{_datadir}/%{name}/scripts/
install -m 755 files/validate_config.py %{buildroot}/%{_datadir}/%{name}/scripts/
install -m 755 files/sdw-admin.py %{buildroot}/%{_bindir}/sdw-admin
Expand All @@ -101,9 +101,9 @@ install -m 644 files/press.freedom.SecureDropUpdater.desktop %{buildroot}/srv/sa
install -m 644 files/securedrop-128x128.png %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps/securedrop.png
install -m 644 files/securedrop-128x128.png %{buildroot}/srv/salt/sd/sd-workstation/logo-small.png
install -m 644 files/securedrop-scalable.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/securedrop.svg
install -m 755 files/sdw-updater %{buildroot}/%{_bindir}/
install -m 755 files/sdw-notify %{buildroot}/%{_bindir}/
install -m 755 files/sdw-login %{buildroot}/%{_bindir}/
install -m 755 files/sdw-updater.py %{buildroot}/%{_bindir}/sdw-updater
install -m 755 files/sdw-notify.py %{buildroot}/%{_bindir}/sdw-notify
install -m 755 files/sdw-login.py %{buildroot}/%{_bindir}/sdw-login
install -m 644 files/sdw-notify.service %{buildroot}/%{_userunitdir}/
install -m 644 files/sdw-notify.timer %{buildroot}/%{_userunitdir}/

Expand Down
File renamed without changes.

0 comments on commit fe8af6e

Please sign in to comment.