Skip to content

Commit

Permalink
Merge pull request #18 from CSCfi/feature/python-3.10
Browse files Browse the repository at this point in the history
switch to python 3.10
  • Loading branch information
teemukataja authored Feb 22, 2023
2 parents 35c0213 + c17fc33 commit 9f8dbdb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 29 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
create_release:
Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
artifact_name: crypt4gh-gui
os_suffix: macos-amd64
asset_name: crypt4gh-gui
python-version: [3.8]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
docker pull cscfi/pyinstaller
docker run --rm -v "${PWD}:/builder" cscfi/pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
sudo chown -R $USER:$GROUP dist/
- name: Build artifact
- name: Build artifact
if: matrix.os != 'ubuntu-latest'
run: |
pyinstaller --noconsole --onefile crypt4gh_gui.py --name ${{ matrix.asset_name }}
Expand All @@ -86,7 +86,7 @@ jobs:
cd ./dist
zip --junk-paths ${{ matrix.asset_name }}-python${{ matrix.python-version }}-${{ matrix.os_suffix }}.zip ${{ matrix.artifact_name }}
- name: Upload Release Asset
id: upload-release-asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Black formatting check
run: tox -e black
- name: Flake8 syntax check
run: tox -e flake8
- name: Type hints check
run: tox -e mypy
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Black formatting check
run: tox -e black
- name: Flake8 syntax check
run: tox -e flake8
- name: Type hints check
run: tox -e mypy
32 changes: 26 additions & 6 deletions crypt4gh_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def __init__(self, window: tk.Tk) -> None:
self.my_key_field.grid(column=0, row=1, sticky=tk.W)
self.my_key_field.config(state="disabled")
# Auto-load generated private key if such exists: username_crypt4gh.key (can be changed in UI)
default_private_key_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), f"{getpass.getuser()}_crypt4gh.key")
default_private_key_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
f"{getpass.getuser()}_crypt4gh.key",
)
if os.path.isfile(default_private_key_path):
self.my_key_value.set(default_private_key_path)

Expand Down Expand Up @@ -103,7 +106,12 @@ def __init__(self, window: tk.Tk) -> None:
)
self.load_their_key_button.grid(column=1, row=2, sticky=tk.E, columnspan=2)

self.select_file_button = tk.Button(window, text="Select File", width=OS_CONFIG["config_button_width"], command=partial(self.open_file, "file"))
self.select_file_button = tk.Button(
window,
text="Select File",
width=OS_CONFIG["config_button_width"],
command=partial(self.open_file, "file"),
)
self.select_file_button.grid(column=1, row=3, sticky=tk.E, columnspan=2)

self.encrypt_button = tk.Button(
Expand Down Expand Up @@ -156,7 +164,11 @@ def password_prompt(self, action: Optional[str]) -> None:
# This if-clause is for preventing error messages
if password1 is None:
return
password2 = askstring("Private Key Passphrase", "Re-type Private Key Passphrase to Confirm", show="*")
password2 = askstring(
"Private Key Passphrase",
"Re-type Private Key Passphrase to Confirm",
show="*",
)
if password2 is None:
return
if password1 != password2:
Expand Down Expand Up @@ -191,7 +203,11 @@ def password_prompt(self, action: Optional[str]) -> None:
if password is None:
return
while len(password) == 0:
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
password = askstring(
"Private Key Passphrase",
"Passphrase can't be empty",
show="*",
)
# This if-clause is for preventing error messages
if password is None:
return
Expand All @@ -207,7 +223,7 @@ def password_prompt(self, action: Optional[str]) -> None:
if private_key is not None:
their_key = get_public_key(self.their_key_value.get())
print("Encrypting...")
encrypted_file: Union[BufferedWriter, BufferedReader]
encrypted_file_wb: Union[BufferedWriter, BufferedReader]
original_file = open(self.file_value.get(), "rb")
encrypted_file_wb = open(f"{self.file_value.get()}.c4gh", "wb")
encrypt([(0, private_key, their_key)], original_file, encrypted_file_wb)
Expand All @@ -230,7 +246,11 @@ def password_prompt(self, action: Optional[str]) -> None:
if password is None:
return
while len(password) == 0:
password = askstring("Private Key Passphrase", "Passphrase can't be empty", show="*")
password = askstring(
"Private Key Passphrase",
"Passphrase can't be empty",
show="*",
)
# This if-clause is for preventing error messages
if password is None:
return
Expand Down

0 comments on commit 9f8dbdb

Please sign in to comment.