[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#807104: marked as done (python-apt-doc: Use of print statements not compatible with python3)



Your message dated Sun, 13 Mar 2016 15:37:09 +0000
with message-id <E1af84r-0003QK-SP@franck.debian.org>
and subject line Bug#807104: fixed in python-apt 1.1.0~beta2
has caused the Debian Bug report #807104,
regarding python-apt-doc: Use of print statements not compatible with python3
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
807104: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807104
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python-apt-doc
Version: 1.1.0~beta1
Severity: normal
Tags: patch

The examples make use of the print statements such that it is
incompatible with python3, e.g.:

    print "Essential packages:"
    print >> sys.stderr, "need filename argument"

The attached patch modifies these lines to read:

    print("Essential packages:")
    sys.stderr.write("need filename argument\n")

--

>From 331782006251adb25118cd1343c74a1765280b4f Mon Sep 17 00:00:00 2001
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
Date: Thu, 3 Dec 2015 13:34:07 +0100
Subject: [PATCH] Convert print statements so they work in python3

---
 doc/source/examples/cache-packages.py    |  8 ++++----
 doc/source/examples/cache-pkgfile.py     | 16 ++++++++--------
 doc/source/examples/dpkg-contents.py     |  4 ++--
 doc/source/examples/dpkg-extract.py      |  4 ++--
 doc/source/examples/dpkg-info.py         |  4 ++--
 doc/source/examples/missing-deps.py      | 10 +++++-----
 doc/source/examples/update-print-uris.py |  2 +-
 doc/source/library/apt.cache.rst         |  2 +-
 doc/source/library/apt.package.rst       |  6 +++---
 doc/source/library/apt_pkg.rst           |  8 ++++----
 doc/source/tutorials/apt-get.rst         |  2 +-
 11 files changed, 33 insertions(+), 33 deletions(-)
 mode change 100644 => 100755 doc/source/examples/cache-packages.py
 mode change 100644 => 100755 doc/source/examples/cache-pkgfile.py
 mode change 100644 => 100755 doc/source/examples/dpkg-contents.py
 mode change 100644 => 100755 doc/source/examples/dpkg-extract.py
 mode change 100644 => 100755 doc/source/examples/dpkg-info.py
 mode change 100644 => 100755 doc/source/examples/missing-deps.py
 mode change 100644 => 100755 doc/source/examples/update-print-uris.py

diff --git a/doc/source/examples/cache-packages.py b/doc/source/examples/cache-packages.py
old mode 100644
new mode 100755
index 7253430..0a4c34e
--- a/doc/source/examples/cache-packages.py
+++ b/doc/source/examples/cache-packages.py
@@ -9,14 +9,14 @@ def main():
     apt_pkg.init_config()
     apt_pkg.init_system()
     cache = apt_pkg.Cache()
-    print "Essential packages:"
+    print("Essential packages:")
     for pkg in cache.packages:
         if pkg.essential:
-            print " ", pkg.name
-    print "Important packages:"
+            print(" ", pkg.name)
+    print("Important packages:")
     for pkg in cache.packages:
         if pkg.important:
-            print " ", pkg.name
+            print(" ", pkg.name)
 
 if __name__ == "__main__":
     main()
diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py
old mode 100644
new mode 100755
index 10216c1..bbf9b61
--- a/doc/source/examples/cache-pkgfile.py
+++ b/doc/source/examples/cache-pkgfile.py
@@ -7,23 +7,23 @@ def main():
     apt_pkg.init()
     cache = apt_pkg.Cache()
     for pkgfile in cache.file_list:
-        print 'Package-File:', pkgfile.filename
-        print 'Index-Type:', pkgfile.index_type  # 'Debian Package Index'
+        print('Package-File:', pkgfile.filename)
+        print('Index-Type:', pkgfile.index_type)  # 'Debian Package Index'
         if pkgfile.not_source:
-            print 'Source: None'
+            print('Source: None')
         else:
             if pkgfile.site:
                 # There is a source, and a site, print the site
-                print 'Source:', pkgfile.site
+                print('Source:', pkgfile.site)
             else:
                 # It seems to be a local repository
-                print 'Source: Local package file'
+                print('Source: Local package file')
         if pkgfile.not_automatic:
             # The system won't be updated automatically (eg. experimental)
-            print 'Automatic: No'
+            print('Automatic: No')
         else:
-            print 'Automatic: Yes'
-        print
+            print('Automatic: Yes')
+        print()
 
 if __name__ == '__main__':
     main()
diff --git a/doc/source/examples/dpkg-contents.py b/doc/source/examples/dpkg-contents.py
old mode 100644
new mode 100755
index 9497cf8..ec730c4
--- a/doc/source/examples/dpkg-contents.py
+++ b/doc/source/examples/dpkg-contents.py
@@ -38,13 +38,13 @@ def callback(what, name, link, mode, uid, gid, size, mtime, major, minor):
     s_name = name.startswith(".") and name or ("./" + name)
     if link:
         s_name += " link to %s" % link
-    print s_mode, s_owner, s_size, s_time, s_name
+    print(s_mode, s_owner, s_size, s_time, s_name)
 
 
 def main():
     """Main function"""
     if len(sys.argv) < 2:
-        print >> sys.stderr, "need filename argumnet"
+        sys.stderr.write("need filename argument\n")
         sys.exit(1)
 
     fobj = open(sys.argv[1])
diff --git a/doc/source/examples/dpkg-extract.py b/doc/source/examples/dpkg-extract.py
old mode 100644
new mode 100755
index 8d14402..42e38dc
--- a/doc/source/examples/dpkg-extract.py
+++ b/doc/source/examples/dpkg-extract.py
@@ -9,10 +9,10 @@ import apt_inst
 def main():
     """Main function."""
     if len(sys.argv) < 3:
-        print >> sys.stderr, "Usage:", __file__, "package.deb outdir"
+        sys.stderr.write("Usage: %s package.deb outdir\n" % (__file__))
         sys.exit(1)
     if not os.path.exists(sys.argv[2]):
-        print >> sys.stderr, "The directory %s does not exist" % sys.argv[2]
+        sys.stderr.write("The directory %s does not exist\n" % (sys.argv[2]))
         sys.exit(1)
 
     fobj = open(sys.argv[1])
diff --git a/doc/source/examples/dpkg-info.py b/doc/source/examples/dpkg-info.py
old mode 100644
new mode 100755
index af22059..85391be
--- a/doc/source/examples/dpkg-info.py
+++ b/doc/source/examples/dpkg-info.py
@@ -8,11 +8,11 @@ from apt_inst import DebFile
 def main():
     """Main function."""
     if len(sys.argv) < 3:
-        print >> sys.stderr, 'Usage: tool file.deb control-file'
+        sys.stderr.write('Usage: tool file.deb control-file\n')
         sys.exit(0)
     fobj = open(sys.argv[1])
     try:
-        print DebFile(fobj).control.extractdata(sys.argv[2])
+        print(DebFile(fobj).control.extractdata(sys.argv[2]))
     finally:
         fobj.close()
 
diff --git a/doc/source/examples/missing-deps.py b/doc/source/examples/missing-deps.py
old mode 100644
new mode 100755
index b9ccdc1..3718e2d
--- a/doc/source/examples/missing-deps.py
+++ b/doc/source/examples/missing-deps.py
@@ -22,12 +22,12 @@ def check_version(pkgver):
             missing.append(or_group)
 
     if missing:
-        print "Package:", pkgver.parent_pkg.name
-        print "Version:", pkgver.ver_str
-        print "Missing:",
-        print ", ".join(" | ".join(fmt_dep(dep) for dep in or_group)
+        print("Package:", pkgver.parent_pkg.name)
+        print("Version:", pkgver.ver_str)
+        print("Missing:")
+        print(", ".join(" | ".join(fmt_dep(dep) for dep in or_group))
                         for or_group in missing)
-        print
+        print()
 
 
 def main():
diff --git a/doc/source/examples/update-print-uris.py b/doc/source/examples/update-print-uris.py
old mode 100644
new mode 100755
index dbe1dfd..5a7c235
--- a/doc/source/examples/update-print-uris.py
+++ b/doc/source/examples/update-print-uris.py
@@ -17,7 +17,7 @@ def main():
 
     # Now print the URI of every item.
     for item in acquire.items:
-        print item.desc_uri
+        print(item.desc_uri)
 
 if __name__ == '__main__':
     main()
diff --git a/doc/source/library/apt.cache.rst b/doc/source/library/apt.cache.rst
index d0e4459..f85deb2 100644
--- a/doc/source/library/apt.cache.rst
+++ b/doc/source/library/apt.cache.rst
@@ -67,7 +67,7 @@ packages whose state has been changed, eg. packages marked for installation::
     >>> cache = apt.Cache()
     >>> changed = apt.FilteredCache(cache)
     >>> changed.set_filter(MarkedChangesFilter())
-    >>> print len(changed) == len(cache.get_changes()) # Both need to have same length
+    >>> print(len(changed) == len(cache.get_changes())) # Both need to have same length
     True
 
 The ProblemResolver class
diff --git a/doc/source/library/apt.package.rst b/doc/source/library/apt.package.rst
index 1a69c1e..ec7ed36 100644
--- a/doc/source/library/apt.package.rst
+++ b/doc/source/library/apt.package.rst
@@ -109,14 +109,14 @@ Examples
 
     cache = apt.Cache()
     pkg = cache['python-apt'] # Access the Package object for python-apt
-    print 'python-apt is trusted:', pkg.candidate.origins[0].trusted
+    print('python-apt is trusted:', pkg.candidate.origins[0].trusted)
 
     # Mark python-apt for install
     pkg.mark_install()
 
-    print 'python-apt is marked for install:', pkg.marked_install
+    print('python-apt is marked for install:', pkg.marked_install)
 
-    print 'python-apt is (summary):', pkg.candidate.summary
+    print('python-apt is (summary):', pkg.candidate.summary)
 
     # Now, really install it
     cache.commit()
diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst
index 5256931..9b570cd 100644
--- a/doc/source/library/apt_pkg.rst
+++ b/doc/source/library/apt_pkg.rst
@@ -1282,7 +1282,7 @@ Index Files
 
             for pkgfile in cache.file_list:
                 if pkgfile.not_source:
-                    print 'The file %s has no source.' % pkgfile.filename
+                    print('The file %s has no source.' % pkgfile.filename)
 
     .. attribute:: origin
 
@@ -1350,7 +1350,7 @@ Records (Release files, Packages, Sources)
             cand = depcache.get_candidate_ver(cache['python-apt'])
             records.lookup(cand.file_list[0])
             # Now you can access the record
-            print records.source_pkg # == python-apt
+            print(records.source_pkg) # == python-apt
 
     .. attribute:: filename
 
@@ -1435,7 +1435,7 @@ Records (Release files, Packages, Sources)
         Example::
 
             section = apt_pkg.TagSection(records.record)
-            print section['SHA256'] # Use records.sha256_hash instead
+            print(section['SHA256']) # Use records.sha256_hash instead
 
 
 .. class:: SourceRecords
@@ -1957,7 +1957,7 @@ section as a string.
 
         with apt_pkg.TagFile('/var/lib/dpkg/status') as tagfile:
             for section in tagfile:
-                print section['Package']
+                print(section['Package'])
 
     .. versionchanged:: 0.7.100
         Added support for using gzip files, via :class:`gzip.GzipFile` or any
diff --git a/doc/source/tutorials/apt-get.rst b/doc/source/tutorials/apt-get.rst
index f8dd089..26ebc3d 100644
--- a/doc/source/tutorials/apt-get.rst
+++ b/doc/source/tutorials/apt-get.rst
@@ -38,7 +38,7 @@ URIs. Luckily, there is :attr:`apt_pkg.Acquire.items` which allows us to
 iterate over the items::
 
     for item in acquire.items:
-        print item.desc_uri
+        print(item.desc_uri)
 
 In the end a program could look like this:
 
-- 
2.6.2


--- End Message ---
--- Begin Message ---
Source: python-apt
Source-Version: 1.1.0~beta2

We believe that the bug you reported is fixed in the latest version of
python-apt, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 807104@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Julian Andres Klode <jak@debian.org> (supplier of updated python-apt package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 13 Mar 2016 15:48:44 +0100
Source: python-apt
Binary: python-apt python-apt-doc python-apt-dbg python-apt-dev python-apt-common python3-apt python3-apt-dbg
Architecture: source
Version: 1.1.0~beta2
Distribution: unstable
Urgency: medium
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Julian Andres Klode <jak@debian.org>
Description:
 python-apt - Python interface to libapt-pkg
 python-apt-common - Python interface to libapt-pkg (locales)
 python-apt-dbg - Python interface to libapt-pkg (debug extension)
 python-apt-dev - Python interface to libapt-pkg (development files)
 python-apt-doc - Python interface to libapt-pkg (API documentation)
 python3-apt - Python 3 interface to libapt-pkg
 python3-apt-dbg - Python 3 interface to libapt-pkg (debug extension)
Closes: 725720 791345 806596 807103 807104 807105 812099
Changes:
 python-apt (1.1.0~beta2) unstable; urgency=medium
 .
   [ Julian Andres Klode ]
   * tests/test_all.py: Only use test files starting with test_
   * tests: Rename test_pep8 to testmanual_pep8
   * pre-build.sh: Run PEP8 check
   * apt/README.apt: Drop it, we cannot pretend unstable API anymore
   * depcache: Call SetLog() and GetLock on Acquire instead of Setup
   * Fix regression from previous commit WRT Py_None reference count
   * pkgsrcrecords: Use Files2 instead of Files, part1: Size
   * Introduce apt_pkg.HashStringList()
   * pkgrecords: Use hashes instead of deprecated MD5Hash and friends
   * whatsnew: 1.1: Document HashStringList and PackageRecords changes
   * hashstring: Constify where possible
   * Drop deprecated uses of Hashes, add hashes attribute
   * HashStringList: Check for negative index, fix signed vs unsigned
   * acquire: Call SetLog() instead of Setup()
   * apt_pkg: Deprecate rewrite_section
   * arfile, tarfile: Decode member names using filesystem encoding
     (Closes: #806596)
   * CppPyString: Use an const std::string reference instead of value
   * Make Safe_FromString an overloaded version of CppPyString
   * Use CppPyString instead of PyString_FromString everywhere
   * Drop compat macros for python2 (< 2.6)
   * Drop deprecation-ignore macros, use APT ones instead
   * Use CppPyPath for returning (hopefully) all paths
   * apt_inst: Do not mention deprecated functions, except for porting
     (Closes: #807103)
   * control: Suggest apt, so reportbug reports apt version
   * Drop binding for SmartTargetPkg() (Closes: #791345)
   * debfile: Mention dpkg --add-architecture when arch is wrong
     (Closes: #725720)
   * Introduce apt_pkg.Error class replacing SystemError
   * CppPyObject_NEW: Make template variadic
   * Revert "CppPyObject_NEW: Make template variadic"
   * Add apt_pkg.Tag and subclasses (one per kind of tag)
   * TagSection: Check for NUL bytes in the tag section input
   * python-apt-common: Drop python | python3 depends (Closes: #812099)
   * apt.Cache: Provide get()
 .
   [ Felix Dietrich ]
   * doc: Fix typo (Closes: #807105)
   * Use print function from __future__ in examples (Closes: #807104)
 .
   [ Brian Murray ]
   * Fix typo regarding upgradeable packages.
Checksums-Sha1:
 869a621d0c094cd92ce64e1f8dfb77d42f550126 2243 python-apt_1.1.0~beta2.dsc
 855a74b91c9ff998cf2e57f4a6b19e9ebf6c5b57 316628 python-apt_1.1.0~beta2.tar.xz
Checksums-Sha256:
 ae775f3da24b9c5b8d3c6176f719fe15acceb3d838b52745723d38febc7a6694 2243 python-apt_1.1.0~beta2.dsc
 b9dcff7f7b51035185d9a204ba39ab7111bb777ffa57913bb7b2de71bc2f7f44 316628 python-apt_1.1.0~beta2.tar.xz
Files:
 5cd7858a45e66e48db9e86cee4313838 2243 python standard python-apt_1.1.0~beta2.dsc
 63617e86ff767da6153ec4a505dbfabf 316628 python standard python-apt_1.1.0~beta2.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJW5X4ZAAoJENc8OeVlgLOGSRgP/1wh5UZmFaRfYnRiDo0jK8/U
ybkYnj2GTxiE2TYtpujbW6zcTzyRfb2qMS0JRK934PEM0hLUOn3MFcu+F5SiW3Fz
EHt/UlKjC/2mMOOZUDRvJsUTCyYvzDF49KVRCJTxxFAhTz0TOa9XoL2guIZT2ckL
xP635gh+0fV2nE9Lx/g9aVJi3I0X6LCcPrSHx2/IlM2YVlq5itUqBy0Zx3p3gynh
eij6lg6nTyv7q0ruwqrNLEqQGygEo+r7M7PDjOsgSlKUt8VLn1dFImR9+tVbLr5V
VH9G38ZVUsfKU58hGZP1L8ljqHFyOOKtFC9nJGPJ7sv3+pPDWUf2VUgrdC/VURqu
K3LBkD77nFjmOmnxh9dtW8qq70tWf5UnSGi4kjggLyBCay0gbvDs/DfnUAGy+PTc
QKUNeqfhGtXaFjWUVYB+V5Bl/QVovk2dInWAfHtE04clPjw0NO+L333ZpQLYPT8+
+Q7djEv2Rxdy6MrW/vkeRQkT3diC6vDMWGw/r+BjXv3zOaY6cZ+FVZuaiHEAV0Oi
klqMqxBCuc1nNKJpiJA26KW4C3oxSk9Oh7bBz9GeJ5G08u9/I96EjChYZPxqKHil
hWKieYW1ykisscfbFEMMh+8VMVYxhGQ6EaItdxqkHa33nquBrKwiKzd2wb91WWmy
LlEdtNWj3GimaqSNEG94
=BjNN
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: