Adding python3 support and gutenprint packages

This commit is contained in:
root
2020-12-23 23:45:34 -07:00
parent 663f17a6cd
commit 6e83a42ff4
3 changed files with 26 additions and 10 deletions

View File

@@ -8,17 +8,21 @@ RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositorie
cups-client \
cups-filters \
cups-dev \
gutenprint \
gutenprint-libs \
gutenprint-doc \
gutenprint-cups \
ghostscript \
avahi \
inotify-tools \
python \
python-dev \
py-pip \
python3 \
python3-dev \
py3-pip \
build-base \
wget \
rsync \
&& pip --no-cache-dir install --upgrade pip \
&& pip install pycups \
&& pip3 --no-cache-dir install --upgrade pip \
&& pip3 install pycups \
&& rm -rf /var/cache/apk/*
# This will use port 631

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Copyright (c) 2010 Timothy J Fontaine <tjfontaine@atxconsulting.com>
@@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import cups, os, optparse, re, urlparse
import cups, os, optparse, re
import urllib.parse as urlparse
import os.path
from StringIO import StringIO
from io import StringIO
from xml.dom.minidom import parseString
from xml.dom import minidom
@@ -43,7 +44,8 @@ except:
from elementtree import Element, ElementTree, tostring
etree = None
except:
raise 'Failed to find python libxml or elementtree, please install one of those or use python >= 2.5'
print('Failed to find python libxml or elementtree, please install one of those or use python >= 2.5')
raise
XML_TEMPLATE = """<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
@@ -121,7 +123,7 @@ class AirPrintGenerate(object):
printers = conn.getPrinters()
for p, v in printers.items():
for p, v in list(printers.items()):
if v['printer-is-shared']:
attrs = conn.getPrinterAttributes(p)
uri = urlparse.urlparse(v['printer-uri-supported'])

View File

@@ -2,6 +2,16 @@
set -e
set -x
# Is CUPSADMIN set? If not, set to default
if [ -z "$CUPSADMIN" ]; then
CUPSADMIN="cupsadmin"
fi
# Is CUPSPASSWORD set? If not, set to $CUPSADMIN
if [ -z "$CUPSPASSWORD" ]; then
CUPSPASSWORD=$CUPSADMIN
fi
if [ $(grep -ci $CUPSADMIN /etc/shadow) -eq 0 ]; then
adduser -S -G lpadmin --no-create-home $CUPSADMIN
fi