diff --git a/.travis.yml b/.travis.yml index fa67edf..b3ef466 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,20 +2,25 @@ language: python python: - "2.6" - "2.7" +virtualenv: + system_site_packages: true before_install: - sudo apt-get update -qq - - sudo apt-get install -qq debhelper autotools-dev cups-ppdc libcups2-dev cups + - sudo apt-get install -qq debhelper autotools-dev cups-ppdc libcups2-dev cups python-cups python-httplib2 imagemagick - pip install httplib2 pycups pytest-cov --use-mirrors install: - ./configure - sudo gpasswd -a `whoami` lpadmin - sudo make install - sudo cupsctl --debug-logging - - sudo cp .coveragerc /usr/local/lib/cloudprint-cups/ + - sudo cp .coveragerc /usr/local/share/cloudprint-cups/ - sudo cp testfiles/testppd.ppd /usr/share/cups/model/testppd.ppd script: - - cd /usr/local/lib/cloudprint-cups/ - - sudo chmod -R o+rw . + - cd /usr/local/share/cloudprint-cups/ + - sudo chmod 777 . + - sudo chmod o+rw testfiles + - sudo ./upgrade.py + - sudo python -m compileall . - py.test --cov . - sudo cat /var/log/cups/cloudprint_log /var/log/cups/error_log - sudo unlink /usr/share/cups/model/testppd.ppd diff --git a/Makefile.in b/Makefile.in index e344bef..f8181c4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,5 @@ prefix = $(DESTDIR)@prefix@ +destprefix = @prefix@ srcdir = @srcdir@ INSTALL = @INSTALL@ cupsdriver = ${DESTDIR}@cupsserverpath@/driver/ @@ -9,24 +10,20 @@ cupsgroup = @cupsgroup@ all: backend.py install: all - mkdir -p ${prefix}/lib/cloudprint-cups/oauth2client - mkdir -p ${prefix}/lib/cloudprint-cups/testfiles - ${INSTALL} ${srcdir}/*.py ${prefix}/lib/cloudprint-cups/ - ${INSTALL} ${srcdir}/full-test.sh ${prefix}/lib/cloudprint-cups/ - ${INSTALL} -m 644 ${srcdir}/testfiles/* ${prefix}/lib/cloudprint-cups/testfiles/ - ${INSTALL} -m 644 ${srcdir}/oauth2client/*.py ${prefix}/lib/cloudprint-cups/oauth2client/ + mkdir -p ${prefix}/share/cloudprint-cups/oauth2client + mkdir -p ${prefix}/share/cloudprint-cups/testfiles + ${INSTALL} ${srcdir}/*.py ${prefix}/share/cloudprint-cups/ + ${INSTALL} ${srcdir}/full-test.sh ${prefix}/share/cloudprint-cups/ + unlink ${prefix}/share/cloudprint-cups/pre-commit.py + ${INSTALL} -m 644 ${srcdir}/testfiles/* ${prefix}/share/cloudprint-cups/testfiles/ + ${INSTALL} -m 644 ${srcdir}/oauth2client/*.py ${prefix}/share/cloudprint-cups/oauth2client/ mkdir -p ${cupsbackend} mkdir -p ${cupsdriver} mkdir -p ${cupsmodel} - mkdir -p $(DESTDIR)/var/log/cups/ - touch $(DESTDIR)/var/log/cups/cloudprint_log -ifeq ($(NOPERMS),1) - ${INSTALL} ${srcdir}/backend.py ${cupsbackend}cloudprint - ${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}/dynamicppd.py ${cupsdriver}cupscloudprint - chown root:${cupsgroup} $(DESTDIR)/var/log/cups/cloudprint_log - chown -R root:${cupsgroup} ${prefix}/lib/cloudprint-cups/ - chmod 660 $(DESTDIR)/var/log/cups/cloudprint_log + ln -f -s ${destprefix}/share/cloudprint-cups/backend.py ${cupsbackend}cloudprint + ln -f -s ${destprefix}/share/cloudprint-cups/dynamicppd.py ${cupsdriver}cupscloudprint + ${INSTALL} -m 644 ${srcdir}/README.md ${prefix}/share/cloudprint-cups/README.md + ${INSTALL} -m 644 ${srcdir}/COPYING ${prefix}/share/cloudprint-cups/COPYING +ifneq ($(NOPERMS),1) + chown -R root:${cupsgroup} ${prefix}/share/cloudprint-cups/ endif diff --git a/README.md b/README.md index acbf503..4394820 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,12 @@ Follow configuration below. CONFIGURATION ============= -Run /usr/lib/cloudprint-cups/setupcloudprint.py ( or /usr/local/lib/cloudprint-cups/setupcloudprint.py ) and either allow it to add all +Run /usr/share/cloudprint-cups/setupcloudprint.py ( or /usr/local/share/cloudprint-cups/setupcloudprint.py ) and either allow it to add all Cloud Print printers at once, or say 'N', and add manually: Add a new printer ( via http://127.0.0.1:631 or usual interface ) as a 'Google Cloud Print' network printer. Select the 'Make' as Google, and 'Model' as Cloud Print. Supply the connection name as a simple URI pointing to the printer you want to setup, you can obtain a list of URIs from -/usr/lib/cloudprint-cups/listcloudprinters.py ( or /usr/local/lib/cloudprint-cups/listcloudprinters.py ) : +/usr/share/cloudprint-cups/listcloudprinters.py ( or /usr/local/share/cloudprint-cups/listcloudprinters.py ) : Print a test page, to confirm it is working. diff --git a/backend.py b/backend.py index 5ac156e..d07ccec 100755 --- a/backend.py +++ b/backend.py @@ -20,7 +20,7 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print CUPS Backend Version " + CCPVersion sys.exit(0) @@ -66,9 +66,9 @@ def getBackendDescription ( ) : print getBackendDescription() try: - libpath = "/usr/local/lib/cloudprint-cups/" + libpath = "/usr/local/share/cloudprint-cups/" if not os.path.exists( libpath ): - libpath = "/usr/lib/cloudprint-cups" + libpath = "/usr/share/cloudprint-cups" sys.path.insert(0, libpath) from auth import Auth from printer import Printer @@ -148,9 +148,9 @@ def getBackendDescription ( ) : ps2PdfName = "pstopdf" convertToPDFParams = [ps2PdfName, printFile, pdfFile] - submitjobpath = "/usr/lib/cloudprint-cups/" + "submitjob.py" + submitjobpath = "/usr/share/cloudprint-cups/" + "submitjob.py" if not os.path.exists( submitjobpath ): - submitjobpath = "/usr/local/lib/cloudprint-cups/" + "submitjob.py" + submitjobpath = "/usr/local/share/cloudprint-cups/" + "submitjob.py" if not fileIsPDF( printFile ): sys.stderr.write( "INFO: Converting print job to PDF\n") diff --git a/deleteaccount.py b/deleteaccount.py index 043fcc2..e3f56f2 100755 --- a/deleteaccount.py +++ b/deleteaccount.py @@ -21,7 +21,7 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Delete Account Script Version " + CCPVersion sys.exit(0) diff --git a/dynamicppd.py b/dynamicppd.py index d49fe54..6ba4dd8 100755 --- a/dynamicppd.py +++ b/dynamicppd.py @@ -19,13 +19,13 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Dynamic PPD Generator Version " + CCPVersion sys.exit(0) -libpath = "/usr/local/lib/cloudprint-cups/" +libpath = "/usr/local/share/cloudprint-cups/" if not os.path.exists( libpath ): - libpath = "/usr/lib/cloudprint-cups" + libpath = "/usr/share/cloudprint-cups" sys.path.insert(0, libpath) from auth import Auth diff --git a/full-test.sh b/full-test.sh index da626ca..f61f4cb 100755 --- a/full-test.sh +++ b/full-test.sh @@ -30,6 +30,12 @@ if [[ "`whoami`" == "root" ]]; then hash start && ( start cups || cupsd ) fi +if [[ "`whoami`" == "root" ]]; then + python -m compileall . +else + sudo python -m compileall . +fi + py.test2 || py.test printers="`./dynamicppd.py list | cut -d'"' -f2`" @@ -44,3 +50,5 @@ for printer in $printers; do cupstestppd /tmp/test.ppd done done + +tail /var/log/cups/cloudprint_log \ No newline at end of file diff --git a/listcloudprinters.py b/listcloudprinters.py index 004b5ec..c9bc433 100755 --- a/listcloudprinters.py +++ b/listcloudprinters.py @@ -21,7 +21,7 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Printer Lister Version " + CCPVersion sys.exit(0) diff --git a/packages/arch/INSTALL b/packages/arch/INSTALL deleted file mode 100644 index 5c4f861..0000000 --- a/packages/arch/INSTALL +++ /dev/null @@ -1,4 +0,0 @@ -post_upgrade() { - chgrp lp /etc/cloudprint.conf - /usr/lib/cloudprint-cups/upgrade.py -} \ No newline at end of file diff --git a/packages/arch/PKGBUILD b/packages/arch/PKGBUILD index 106c9ff..3356d31 100644 --- a/packages/arch/PKGBUILD +++ b/packages/arch/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Simon Cadman pkgname=cupscloudprint -pkgver=20131013 +pkgver=20140107 pkgrel=1 pkgdesc="Print via Google Cloud print using CUPS" arch=('any') @@ -8,8 +8,8 @@ url="http://ccp.niftiestsoftware.com" license=('GPL3') depends=('cups' 'pycups' 'python2' 'ghostscript' 'python2-httplib2' 'imagemagick') makedepends=('git') -changelog=ChangeLog -install=INSTALL +changelog=changelog +install=install source=() md5sums=() _gitroot="git://github.com/simoncadman/CUPS-Cloud-Print.git" diff --git a/packages/arch/ChangeLog b/packages/arch/changelog similarity index 100% rename from packages/arch/ChangeLog rename to packages/arch/changelog diff --git a/packages/arch/install b/packages/arch/install new file mode 100644 index 0000000..b629415 --- /dev/null +++ b/packages/arch/install @@ -0,0 +1,9 @@ +post_upgrade() { + echo "Running post upgrade" + /usr/share/cloudprint-cups/upgrade.py +} + +post_install() { + echo "Running post install" + /usr/share/cloudprint-cups/upgrade.py +} \ No newline at end of file diff --git a/packages/debian/README.Debian b/packages/debian/README.Debian index 3435612..a2a0e18 100644 --- a/packages/debian/README.Debian +++ b/packages/debian/README.Debian @@ -2,7 +2,7 @@ cupscloudprint for Debian ------------------------- After installation, run: - sudo /usr/lib/cloudprint-cups/setupcloudprint.py + sudo /usr/share/cloudprint-cups/setupcloudprint.py To setup your printers. -- simon cadman Wed, 14 Mar 2012 14:26:15 +0000 diff --git a/packages/debian/README.source b/packages/debian/README.source index e632fda..75edd45 100644 --- a/packages/debian/README.source +++ b/packages/debian/README.source @@ -1,14 +1,15 @@ +INTRODUCTION +============ +Google Cloud Print driver for CUPS, allows printing to printers hosted on Google Cloud Print ( see http://www.google.com/cloudprint for more information ). + INSTALLATION ============ -RPM/DEB/Ebuild INSTALL ( Recommended ) +PACKAGE INSTALL ( Recommended ) ================================ -Download and install the package for your distro from https://github.com/simoncadman/CUPS-Cloud-Print/downloads . - -Refer to your own specific distribution instructions for how to install the package. - -Follow configuration below. +The recommended way to install CUPS Cloud Print is using your package manager, please see http://ccp.niftiestsoftware.com/ for installation +instructions. SOURCE INSTALL ============== @@ -26,17 +27,23 @@ Follow configuration below. CONFIGURATION ============= -Run /usr/lib/cloudprint-cups/setupcloudprint.py ( or /usr/local/lib/cloudprint-cups/setupcloudprint.py ) and either allow it to add all +Run /usr/share/cloudprint-cups/setupcloudprint.py ( or /usr/local/share/cloudprint-cups/setupcloudprint.py ) and either allow it to add all Cloud Print printers at once, or say 'N', and add manually: Add a new printer ( via http://127.0.0.1:631 or usual interface ) as a 'Google Cloud Print' network printer. Select the 'Make' as Google, and 'Model' as Cloud Print. Supply the connection name as a simple URI pointing to the printer you want to setup, you can obtain a list of URIs from -/usr/lib/cloudprint-cups/listcloudprinters.py ( or /usr/local/lib/cloudprint-cups/listcloudprinters.py ) : +/usr/share/cloudprint-cups/listcloudprinters.py ( or /usr/local/share/cloudprint-cups/listcloudprinters.py ) : Print a test page, to confirm it is working. Assuming the test page prints correctly, installation is complete. +DEVELOPING +========== + +Before commiting to the git repository you should set up the pre-commit hook, this ensures the version numbers in the scripts are updated: + +ln -s ../../pre-commit.py .git/hooks/pre-commit Copyright and Trademark Information =================================== diff --git a/packages/debian/postinst b/packages/debian/postinst index 2d3a03c..92ccc02 100755 --- a/packages/debian/postinst +++ b/packages/debian/postinst @@ -24,7 +24,7 @@ if [[ ! -f /usr/bin/python2 ]]; then fi if [[ $pyversion != "" ]]; then - sed -i "1 s/\/usr\/bin\/env python2$/\/usr\/bin\/env $pyversion/" /usr/lib/cloudprint-cups/{backend.py,deleteaccount.py,dynamicppd.py,listcloudprinters.py,reportissues.py,setupcloudprint.py,submitjob.py,upgrade.py} + 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,submitjob.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/driver/cupscloudprint fi @@ -40,7 +40,7 @@ chmod 750 /usr/lib/cups/driver/cupscloudprint if [[ -e /etc/cloudprint.conf ]]; then chgrp lp /etc/cloudprint.conf fi -chgrp lp /usr/lib/cloudprint-cups/auth.py -/usr/lib/cloudprint-cups/upgrade.py +chgrp lp /usr/share/cloudprint-cups/auth.py +/usr/share/cloudprint-cups/upgrade.py #DEBHELPER# \ No newline at end of file diff --git a/packages/freebsd/Makefile b/packages/freebsd/Makefile index fbbf704..231a942 100644 --- a/packages/freebsd/Makefile +++ b/packages/freebsd/Makefile @@ -26,6 +26,6 @@ USE_GMAKE= yes post-install: chgrp cups /etc/cloudprint.conf - /usr/local/lib/cloudprint-cups/upgrade.py + /usr/local/share/cloudprint-cups/upgrade.py .include diff --git a/packages/gentoo/cupscloudprint.ebuild b/packages/gentoo/cupscloudprint.ebuild index 7b7f904..0a6ad70 100644 --- a/packages/gentoo/cupscloudprint.ebuild +++ b/packages/gentoo/cupscloudprint.ebuild @@ -27,5 +27,5 @@ src_install() { pkg_postinst() { chgrp lp /etc/cloudprint.conf - /usr/lib/cloudprint-cups/upgrade.py + /usr/share/cloudprint-cups/upgrade.py } diff --git a/packages/redhat/SPECS/cupscloudprint.spec b/packages/redhat/SPECS/cupscloudprint.spec index 0730d44..ea58a3d 100644 --- a/packages/redhat/SPECS/cupscloudprint.spec +++ b/packages/redhat/SPECS/cupscloudprint.spec @@ -1,17 +1,20 @@ Name: cupscloudprint Version: %{_version} Release: 1 -Summary: Google Cloud Print driver for CUPS, allows printing to printers hosted on Google Cloud Print +Summary: Print via Google Cloud print using CUPS License: GPLv3+ URL: http://ccp.niftiestsoftware.com Source0: http://ccp.niftiestsoftware.com/cupscloudprint-%{_version}.tar.bz2 -BuildRequires: cups-devel,cups,make,python-httplib2 -Requires: cups,ghostscript,system-config-printer-libs,python-httplib2,ImageMagick +BuildArch: noarch +BuildRequires: python2-devel,cups-devel,cups,make +Requires: cups,system-config-printer-libs,python-httplib2,ghostscript,ImageMagick %description -Google Cloud Print driver for CUPS, allows printing to printers hosted on Google Cloud Print. +Google Cloud Print driver for UNIX-like operating systems. +It allows any application which prints via CUPS to print to Google Cloud +Print directly. %prep %setup -q @@ -21,22 +24,51 @@ Google Cloud Print driver for CUPS, allows printing to printers hosted on Google %configure make %{?_smp_mflags} - %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT NOPERMS=1 %post -chown root:lp /var/log/cups/cloudprint_log -chown -R root:lp /usr/lib/cloudprint-cups/ -chmod 660 /var/log/cups/cloudprint_log -chgrp lp /etc/cloudprint.conf -/usr/lib/cloudprint-cups/upgrade.py +%{_usr}/share/cloudprint-cups/upgrade.py %files -/usr/lib/cloudprint-cups -/usr/lib/cups/backend/cloudprint -/usr/lib/cups/driver/cupscloudprint -%{_localstatedir}/log/cups/cloudprint_log +%{_usr}/%{_lib}/cups/backend/cloudprint +%{_usr}/%{_lib}/cups/driver/cupscloudprint +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/auth.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/cloudprintrequestor.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/printer.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_auth.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_backend.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_cloudprintrequestor.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_mockrequestor.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_printer.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/test_syntax.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/__init__.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/anyjson.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/client.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/clientsecrets.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/crypt.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/locked_file.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/multistore_file.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/backend.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/deleteaccount.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/dynamicppd.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/listcloudprinters.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/full-test.sh +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/reportissues.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/setupcloudprint.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/submitjob.py +%attr(755, root, lp) %{_usr}/share/cloudprint-cups/upgrade.py +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/*.pyc +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/*.pyo +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/*.pyc +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/*.pyo +%attr(644, root, lp) %{_usr}/share/cloudprint-cups/testfiles/* + +%doc %{_usr}/share/cloudprint-cups/COPYING +%doc %{_usr}/share/cloudprint-cups/README.md +%docdir %{_usr}/share/cloudprint-cups/testfiles %changelog +* Tue Jan 07 2014 20140107-1 +- Package fixes for rpmlint \ No newline at end of file diff --git a/reportissues.py b/reportissues.py index ff92d08..708d0be 100755 --- a/reportissues.py +++ b/reportissues.py @@ -19,13 +19,13 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Issue Reporting Script Version " + CCPVersion sys.exit(0) -libpath = "/usr/local/lib/cloudprint-cups/" +libpath = "/usr/local/share/cloudprint-cups/" if not os.path.exists( libpath ): - libpath = "/usr/lib/cloudprint-cups" + libpath = "/usr/share/cloudprint-cups" sys.path.insert(0, libpath) from auth import Auth diff --git a/setupcloudprint.py b/setupcloudprint.py index 34a2957..4d99cfc 100755 --- a/setupcloudprint.py +++ b/setupcloudprint.py @@ -21,7 +21,7 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Setup Script Version " + CCPVersion sys.exit(0) diff --git a/submitjob.py b/submitjob.py index 577d11e..34a5106 100755 --- a/submitjob.py +++ b/submitjob.py @@ -21,7 +21,7 @@ if len(sys.argv) == 2 and sys.argv[1] == 'version': # line below is replaced on commit - CCPVersion = "20140105 180859" + CCPVersion = "20140111 152045" print "CUPS Cloud Print Submit Job Version " + CCPVersion sys.exit(0) diff --git a/test_auth.py b/test_auth.py index 2f01314..14c863e 100755 --- a/test_auth.py +++ b/test_auth.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2011 Simon Cadman # diff --git a/test_backend.py b/test_backend.py index 2cb33f8..3362eb4 100755 --- a/test_backend.py +++ b/test_backend.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2011 Simon Cadman # diff --git a/test_cloudprintrequestor.py b/test_cloudprintrequestor.py index 7bc8a92..77d7205 100755 --- a/test_cloudprintrequestor.py +++ b/test_cloudprintrequestor.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2011 Simon Cadman # diff --git a/test_mockrequestor.py b/test_mockrequestor.py index 4ee11d9..057079f 100644 --- a/test_mockrequestor.py +++ b/test_mockrequestor.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2011 Simon Cadman # diff --git a/test_printer.py b/test_printer.py index 9ef47f5..7fee757 100755 --- a/test_printer.py +++ b/test_printer.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python2 # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2011 Simon Cadman # diff --git a/test_syntax.py b/test_syntax.py deleted file mode 100644 index ded0e0d..0000000 --- a/test_syntax.py +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env python2 -# CUPS Cloudprint - Print via Google Cloud Print -# Copyright (C) 2011 Simon Cadman -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import py_compile, glob - -def test_syntaxCheck(): - for pyFile in glob.glob('*.py'): - assert py_compile.compile(pyFile, doraise=True) == None \ No newline at end of file diff --git a/upgrade.py b/upgrade.py index ba13917..b38ead1 100755 --- a/upgrade.py +++ b/upgrade.py @@ -20,12 +20,21 @@ from oauth2client import multistore_file from auth import Auth +try: + logfile = open('/var/log/cups/cloudprint_log', 'a') +except: + logfile = sys.stdout + logfile.write("Unable to write to log file /var/log/cups/cloudprint_log") + +# line below is replaced on commit +CCPVersion = "20140111 152045" + if len(sys.argv) == 2 and sys.argv[1] == 'version': - # line below is replaced on commit - CCPVersion = "20140105 180859" print "CUPS Cloud Print Upgrade Script Version " + CCPVersion sys.exit(0) +logfile.write("Upgrading to " + CCPVersion + "\n") + try: connection = cups.Connection() except Exception, e: @@ -43,7 +52,7 @@ sys.exit(0) else: - sys.stderr.write("\n\nRun: /usr/lib/cloudprint-cups/setupcloudprint.py to setup your Google Credentials and add your printers to CUPS\n\n") + sys.stderr.write("\n\nRun: /usr/share/cloudprint-cups/setupcloudprint.py to setup your Google Credentials and add your printers to CUPS\n\n") sys.exit(0) for device in cupsprinters: