Permalink
Browse files

Changed protocol to 'gcp://' instead of 'cloudprint://'

  • Loading branch information...
simoncadman committed Jun 21, 2014
1 parent e5a1d7e commit f6de7945c8a79f246b7f41ff1e5c208964e89936
View
@@ -32,10 +32,10 @@ install: all
mkdir -p ${cupsdriver}
mkdir -p ${cupsmodel}
ifeq ($(NOPERMS),1)
- ${INSTALL} ${srcdir}/backend.py ${cupsbackend}cloudprint
+ ${INSTALL} ${srcdir}/backend.py ${cupsbackend}gcp
${INSTALL} ${srcdir}/dynamicppd.py ${cupsdriver}cupscloudprint
else
- ${INSTALL} -g `groups root | cut -d' ' -f1` -o root -m 755 ${srcdir}/backend.py ${cupsbackend}cloudprint
+ ${INSTALL} -g `groups root | cut -d' ' -f1` -o root -m 755 ${srcdir}/backend.py ${cupsbackend}gcp
${INSTALL} -g `groups root | cut -d' ' -f1` -o root -m 755 ${srcdir}/dynamicppd.py ${cupsdriver}cupscloudprint
endif
${INSTALL} -m 644 ${srcdir}/README.md ${prefix}/share/cloudprint-cups/README.md
View
@@ -29,10 +29,10 @@ class Utils:
# Countries where letter sized paper is used, according to:
# http://en.wikipedia.org/wiki/Letter_(paper_size)
_LETTER_COUNTRIES = set(('US', 'CA', 'MX', 'BO', 'CO', 'VE', 'PH', 'CL'))
- _PROTOCOL_NAME = 'cloudprint'
+ _PROTOCOL_NAME = 'gcp'
_PROTOCOL = _PROTOCOL_NAME + '://'
_OLD_PROTOCOL_NAME = 'cloudprint'
- _OLD_PROTOCOL = _PROTOCOL_NAME + '://'
+ _OLD_PROTOCOL = _OLD_PROTOCOL_NAME + '://'
@staticmethod
def FixFilePermissions(filename):
View
@@ -25,16 +25,16 @@ if [[ ! -f /usr/bin/python2 ]]; then
if [[ $pyversion != "" ]]; then
sed -i "1 s/\/usr\/bin\/env python2$/\/usr\/bin\/env $pyversion/" /usr/share/cloudprint-cups/{backend.py,deleteaccount.py,dynamicppd.py,listcloudprinters.py,reportissues.py,setupcloudprint.py,upgrade.py}
- sed -i "1 s/\/usr\/bin\/env python2$/\/usr\/bin\/env $pyversion/" /usr/lib/cups/backend/cloudprint
+ sed -i "1 s/\/usr\/bin\/env python2$/\/usr\/bin\/env $pyversion/" /usr/lib/cups/backend/gcp
sed -i "1 s/\/usr\/bin\/env python2$/\/usr\/bin\/env $pyversion/" /usr/lib/cups/driver/cupscloudprint
fi
fi
touch /var/log/cups/cloudprint_log
chown root:lp /var/log/cups/cloudprint_log
chmod 660 /var/log/cups/cloudprint_log
-chown root:lp /usr/lib/cups/backend/cloudprint
-chmod 750 /usr/lib/cups/backend/cloudprint
+chown root:lp /usr/lib/cups/backend/gcp
+chmod 750 /usr/lib/cups/backend/gcp
chown root:lp /usr/lib/cups/driver/cupscloudprint
chmod 750 /usr/lib/cups/driver/cupscloudprint
chgrp lp /usr/share/cloudprint-cups/auth.py
@@ -56,7 +56,7 @@ fi
%dir %{_usr}/share/cloudprint-cups/testing
%dir %{_usr}/share/cloudprint-cups/selinux
%docdir %{_usr}/share/cloudprint-cups/testing/testfiles
-%{_usr}/%{_lib}/cups/backend/cloudprint
+%{_usr}/%{_lib}/cups/backend/gcp
%{_usr}/%{_lib}/cups/driver/cupscloudprint
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/.coveragerc
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/auth.py
View
@@ -38,10 +38,10 @@ class PrinterManager:
'Throughput', 'UIConstraints', 'VariablePaperSize', 'Version', 'Color', 'Background',
'Stamp', 'DestinationColorProfile'
))
- URIFormatLatest = 1
- URIFormat20140308 = 2
- URIFormat20140307 = 3
- URIFormat20140210 = 4
+ URIFormatLatest = 9999
+ URIFormat20140308 = 3
+ URIFormat20140307 = 2
+ URIFormat20140210 = 1
backendDescription =\
'network %s "%s" "Google Cloud Print" "MFG:Google;MDL:Cloud Print;DES:GoogleCloudPrint;"'
@@ -203,8 +203,11 @@ def parseLegacyURI(self, uristring, requestors):
printerId = urllib.unquote(pathparts[0])
printerName = None
accountName = urllib.unquote(uri.netloc)
- elif uri.scheme == Utils._PROTOCOL:
+ elif uri.scheme == Utils._PROTOCOL_NAME:
formatId = PrinterManager.URIFormatLatest
+ printerId = urllib.unquote(pathparts[0])
+ printerName = None
+ accountName = urllib.unquote(uri.netloc)
return accountName, printerName, printerId, formatId
View
@@ -16,9 +16,9 @@ if [[ -d '/usr/libexec/cups' ]]; then
fi
-if [[ -e "$cupsdir/backend/cloudprint" ]]; then
- echo "$cupsdir/backend/cloudprint file still exists: "
- ls -alR $cupsdir/backend/cloudprint
+if [[ -e "$cupsdir/backend/gcp" ]]; then
+ echo "$cupsdir/backend/gcp file still exists: "
+ ls -alR $cupsdir/backend/gcp
returnval=1
fi
@@ -99,6 +99,14 @@ def test_parseLegacyURI():
assert printerid == "testid"
assert printername is None
+ # 20140621+ format
+ account, printername, printerid, formatid = printerManagerInstance.parseLegacyURI(
+ Utils._PROTOCOL + "testaccount2%40gmail.com/testid", requestors)
+ assert formatid == printerManagerInstance.URIFormatLatest
+ assert account == "testaccount2@gmail.com"
+ assert printerid == "testid"
+ assert printername is None
+
def test_getPrinterIDByDetails():
printerid, requestor = printerManagerInstance.getPrinterIDByDetails(
"testaccount2@gmail.com", "printername", "testid")

0 comments on commit f6de794

Please sign in to comment.