Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from pnahratow/minimal_ci
Add a minimal CI workflow
- Loading branch information
Showing
8 changed files
with
146 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
exclude = venv,docs/.etherpad-backups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: flake8 | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 | ||
- name: Analysing the code with flake8 | ||
run: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ autosave/ | |
lq1/screenshots/ | ||
working/ | ||
releases/ | ||
venv/ | ||
|
||
# ignored files | ||
docs/lqlogos/logomockup-wip2.ora | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
|
||
import os, sys | ||
import os | ||
from PIL import Image | ||
import pdb | ||
|
||
base_folder = os.path.abspath(os.path.dirname(__file__)).replace("\\","/") | ||
base_folder = os.path.abspath(os.path.dirname(__file__)).replace("\\", "/") | ||
converted_folder = base_folder+"/converted/" | ||
if not os.path.exists(converted_folder): | ||
os.makedirs(converted_folder) | ||
os.makedirs(converted_folder) | ||
|
||
files = os.listdir(base_folder) | ||
|
||
converted = 0 | ||
for name in files: | ||
try: | ||
img = Image.open(name) | ||
except (PermissionError, OSError): | ||
## skip anything that can't be opened or isn't an image | ||
continue | ||
|
||
output_file = converted_folder + name | ||
|
||
if not img.width % 16 == 0: | ||
new_width = img.width - (img.width % 16) + 16 | ||
|
||
else: | ||
new_width = img.width | ||
|
||
if not img.height % 16 == 0: | ||
new_height = img.height - (img.height % 16) + 16 | ||
|
||
else: new_height = img.height | ||
|
||
|
||
print(f"Converting: ({img.width}x{img.height}) -> ({new_width}x{new_height}) - {output_file}"); | ||
|
||
resized = img.resize((new_width, new_height), Image.NEAREST) | ||
resized.save(output_file) | ||
converted += 1 | ||
try: | ||
img = Image.open(name) | ||
except (PermissionError, OSError): | ||
# skip anything that can't be opened or isn't an image | ||
continue | ||
|
||
output_file = converted_folder + name | ||
|
||
if not img.width % 16 == 0: | ||
new_width = img.width - (img.width % 16) + 16 | ||
|
||
else: | ||
new_width = img.width | ||
|
||
if not img.height % 16 == 0: | ||
new_height = img.height - (img.height % 16) + 16 | ||
else: | ||
new_height = img.height | ||
|
||
print(f"Converting: ({img.width}x{img.height}) -> ({new_width}x{new_height}) - {output_file}") | ||
|
||
resized = img.resize((new_width, new_height), Image.NEAREST) | ||
resized.save(output_file) | ||
converted += 1 | ||
|
||
plural = "" if converted == 1 else "s" | ||
print(f"Total: {converted} image{plural} converted.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.