Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
67 lines
1.9 KiB
Makefile
67 lines
1.9 KiB
Makefile
PYINSTALLER_CMD := pyinstaller
|
|
TAGGER_BASE ?= ../
|
|
TAGGER_SRC := $(TAGGER_BASE)/comictaggerlib
|
|
|
|
APP_NAME := ComicTagger
|
|
VERSION_STR := $(shell cd .. && python setup.py --version)
|
|
|
|
MAC_BASE := $(TAGGER_BASE)/mac
|
|
DIST_DIR := $(MAC_BASE)/dist
|
|
STAGING := $(MAC_BASE)/$(APP_NAME)
|
|
APP_BUNDLE := $(DIST_DIR)/$(APP_NAME).app
|
|
VOLUME_NAME := "$(APP_NAME)-$(VERSION_STR)"
|
|
DMG_FILE := $(VOLUME_NAME).dmg
|
|
|
|
all: clean dist diskimage
|
|
|
|
dist:
|
|
$(PYINSTALLER_CMD) $(TAGGER_BASE)/comictagger.py -w -n $(APP_NAME) -s
|
|
cp -a $(TAGGER_SRC)/ui $(APP_BUNDLE)/Contents/MacOS
|
|
cp -a $(TAGGER_SRC)/graphics $(APP_BUNDLE)/Contents/MacOS
|
|
cp $(MAC_BASE)/app.icns $(APP_BUNDLE)/Contents/Resources/icon-windowed.icns
|
|
# fix the version string in the Info.plist
|
|
sed -i -e 's/0\.0\.0/$(VERSION_STR)/' $(MAC_BASE)/dist/ComicTagger.app/Contents/Info.plist
|
|
|
|
clean:
|
|
rm -rf $(DIST_DIR) $(MAC_BASE)/build
|
|
rm -f $(MAC_BASE)/*.spec
|
|
rm -f logdict*.log
|
|
rm -f *~ *.pyc *.pyo
|
|
rm -f raw*.dmg
|
|
echo $(VERSION_STR)
|
|
diskimage:
|
|
# Set up disk image staging folder
|
|
rm -rf $(STAGING)
|
|
mkdir $(STAGING)
|
|
cp $(TAGGER_BASE)/release_notes.txt $(STAGING)
|
|
ln -s /Applications $(STAGING)/Applications
|
|
cp -a $(APP_BUNDLE) $(STAGING)
|
|
cp $(MAC_BASE)/volume.icns $(STAGING)/.VolumeIcon.icns
|
|
SetFile -c icnC $(STAGING)/.VolumeIcon.icns
|
|
|
|
# generate raw disk image
|
|
rm -f $(DMG_FILE)
|
|
hdiutil create -srcfolder $(STAGING) -volname $(VOLUME_NAME) -format UDRW -ov raw-$(DMG_FILE)
|
|
|
|
# remove working files and folders
|
|
rm -rf $(STAGING)
|
|
|
|
# we now have a raw DMG file.
|
|
|
|
# remount it so we can set the volume icon properly
|
|
mkdir -p $(STAGING)
|
|
hdiutil attach raw-$(DMG_FILE) -mountpoint $(STAGING)
|
|
SetFile -a C $(STAGING)
|
|
hdiutil detach $(STAGING)
|
|
rm -rf $(STAGING)
|
|
|
|
# convert the raw image
|
|
rm -f $(DMG_FILE)
|
|
hdiutil convert raw-$(DMG_FILE) -format UDZO -o $(DMG_FILE)
|
|
rm -f raw-$(DMG_FILE)
|
|
|
|
# move finished product to release folder
|
|
mkdir -p $(TAGGER_BASE)/release
|
|
mv $(DMG_FILE) $(TAGGER_BASE)/release
|
|
|