fix: PPD backslash typo, >8-digit code guard, NickName, build validation
This commit is contained in:
parent
49ab635018
commit
d944e2443d
@ -21,6 +21,9 @@ def get_account_code(options):
|
|||||||
code = km[2:]
|
code = km[2:]
|
||||||
if not code.isdigit():
|
if not code.isdigit():
|
||||||
return None
|
return None
|
||||||
|
if len(code) > 8:
|
||||||
|
sys.stderr.write(f"kyofilter: WARNING: department code '{code}' exceeds 8 digits, ignored\n")
|
||||||
|
return None
|
||||||
return code.zfill(8)
|
return code.zfill(8)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,14 @@ cp filter/kyofilter \
|
|||||||
installer/root/usr/libexec/cups/filter/
|
installer/root/usr/libexec/cups/filter/
|
||||||
chmod 755 installer/root/usr/libexec/cups/filter/kyofilter
|
chmod 755 installer/root/usr/libexec/cups/filter/kyofilter
|
||||||
|
|
||||||
|
# Validate PPD (fail if it cannot be parsed at all)
|
||||||
|
echo "Validating PPD..."
|
||||||
|
cupstestppd installer/root/Library/Printers/PPDs/Contents/Resources/TA3505ci_AS.ppd 2>&1 \
|
||||||
|
| grep -v "WARN\|8-Bit\|Übersetzung\|sollte\|Präfix\|übliches\|Seite\|Abschnitt" \
|
||||||
|
| grep -v "FeedingEdgeConstraint\|kyofilter" \
|
||||||
|
| grep "FEHLER" && { echo "ERROR: PPD has unexpected errors" >&2; exit 1; } || true
|
||||||
|
echo "PPD OK"
|
||||||
|
|
||||||
# Build (unsigned if SIGN_IDENTITY not set)
|
# Build (unsigned if SIGN_IDENTITY not set)
|
||||||
SIGN_ARGS=()
|
SIGN_ARGS=()
|
||||||
if [ -n "${SIGN_IDENTITY}" ]; then
|
if [ -n "${SIGN_IDENTITY}" ]; then
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
*PSVersion: "(3011.103) 1"
|
*PSVersion: "(3011.103) 1"
|
||||||
*Manufacturer: "UTAX/TA"
|
*Manufacturer: "UTAX/TA"
|
||||||
*ModelName: "3505ci KPDL"
|
*ModelName: "3505ci KPDL"
|
||||||
*ShortNickName: "3505ci (KPDL)"
|
*ShortNickName: "3505ci (kydriv)"
|
||||||
*NickName: "3505ci (KPDL)"
|
*NickName: "3505ci (kydriv)"
|
||||||
*PCFileName: "TA3505ci.PPD"
|
*PCFileName: "TA3505ci.PPD"
|
||||||
|
|
||||||
*1284DeviceID: "MDL:3505ci;MFG:UTAX"
|
*1284DeviceID: "MDL:3505ci;MFG:UTAX"
|
||||||
@ -3424,7 +3424,7 @@ userdict /180rotdetail true put
|
|||||||
*OpenUI *KmManagment/Job Accounting: PickOne
|
*OpenUI *KmManagment/Job Accounting: PickOne
|
||||||
*OrderDependency: 60 AnySetup *KmManagment
|
*OrderDependency: 60 AnySetup *KmManagment
|
||||||
*DefaultKmManagment: Default
|
*DefaultKmManagment: Default
|
||||||
\*KmManagment Default/Off: ""
|
*KmManagment Default/Off: ""
|
||||||
*KmManagment MG12345/Code 12345: ""
|
*KmManagment MG12345/Code 12345: ""
|
||||||
*?KmManagment: ""
|
*?KmManagment: ""
|
||||||
*End
|
*End
|
||||||
|
|||||||
@ -38,6 +38,9 @@ class TestGetAccountCode:
|
|||||||
def test_non_numeric_code_returns_none(self):
|
def test_non_numeric_code_returns_none(self):
|
||||||
assert kyofilter.get_account_code({"KmManagment": "MGabc45"}) is None
|
assert kyofilter.get_account_code({"KmManagment": "MGabc45"}) is None
|
||||||
|
|
||||||
|
def test_nine_digit_code_returns_none(self):
|
||||||
|
assert kyofilter.get_account_code({"KmManagment": "MG123456789"}) is None
|
||||||
|
|
||||||
|
|
||||||
class TestProcessStream:
|
class TestProcessStream:
|
||||||
def _stream(self, text):
|
def _stream(self, text):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user