3
0
mirror of https://git.launchpad.net/ubuntu-dev-tools synced 2025-03-13 08:01:09 +00:00

Port Python scripts to Python 3, remove python 2 modules. (Closes: , LP: )

This commit is contained in:
Stefano Rivera 2019-09-04 19:21:48 -03:00
parent 3d345113cc
commit bb765237db
7 changed files with 47 additions and 106 deletions

2
debian/changelog vendored

@ -5,6 +5,8 @@ ubuntu-dev-tools (0.173) UNRELEASED; urgency=medium
use the same directory as the newer one, and break.
* Drop 404main, it's been totally broken for years.
* Use python3-debian's Version class in merge-changelog, to support Python 3.
* Port Python scripts to Python 3, remove python 2 modules.
(Closes: #938740, LP: #1099537)
[ Scott Kitterman ]
* Update requestsync to python3 (Closes: #927147)

40
debian/control vendored

@ -15,16 +15,6 @@ Build-Depends:
libwww-perl,
lsb-release,
pylint (>= 2),
python-all (>= 2.6.5-13~),
python-apt (>= 0.7.93~),
python-debian (>= 0.1.20~),
python-distro-info (>= 0.4~),
python-flake8,
python-httplib2,
python-launchpadlib (>= 1.5.7),
python-mock,
python-setuptools,
python-unittest2,
python3-all,
python3-apt,
python3-debian,
@ -54,14 +44,6 @@ Depends:
distro-info (>= 0.2~),
dpkg-dev,
lsb-release,
python,
python-apt (>= 0.7.93~),
python-debian (>= 0.1.20~),
python-distro-info (>= 0.4~),
python-httplib2,
python-launchpadlib (>= 1.5.7),
python-lazr.restfulclient,
python-ubuntutools,
python3,
python3-apt,
python3-debian,
@ -93,7 +75,6 @@ Recommends:
reportbug (>= 3.39ubuntu1),
ubuntu-keyring | ubuntu-archive-keyring,
Suggests:
python-simplejson | python (>= 2.7),
qemu-user-static,
Description: useful tools for Ubuntu developers
This is a collection of useful tools that Ubuntu developers use to make their
@ -142,27 +123,6 @@ Description: useful tools for Ubuntu developers
package.
- update-maintainer - script to update maintainer field in ubuntu packages.
Package: python-ubuntutools
Architecture: all
Section: python
Depends:
python-debian,
python-distro-info,
python-httplib2,
python-launchpadlib,
sensible-utils,
${misc:Depends},
${python:Depends},
Breaks:
ubuntu-dev-tools (<< 0.154),
Replaces:
ubuntu-dev-tools (<< 0.154),
Description: useful APIs for Ubuntu developer tools — Python 2 library
This package ships a collection of APIs, helpers and wrappers used to
develop useful utilities for Ubuntu developers.
.
This package installs the library for Python 2.
Package: python3-ubuntutools
Architecture: all
Section: python

@ -1 +0,0 @@
/usr/lib/python2.7

2
debian/rules vendored

@ -1,4 +1,4 @@
#!/usr/bin/make -f
%:
dh $@ --with python2,python3 --buildsystem=pybuild
dh $@ --with python3 --buildsystem=pybuild

@ -4,7 +4,6 @@ from setuptools import setup
import glob
import os
import re
import sys
import codecs
# look/set what version we have
@ -15,8 +14,7 @@ if os.path.exists(changelog):
if match:
version = match.group(1)
if sys.version_info[0] >= 3:
scripts = [
scripts = [
'backportpackage',
'bitesize',
'check-mir',
@ -48,16 +46,13 @@ if sys.version_info[0] >= 3:
'ubuntu-iso',
'ubuntu-upload-permission',
'update-maintainer',
]
data_files = [
]
data_files = [
('share/bash-completion/completions', glob.glob("bash_completion/*")),
('share/man/man1', glob.glob("doc/*.1")),
('share/man/man5', glob.glob("doc/*.5")),
('share/ubuntu-dev-tools', ['enforced-editing-wrapper']),
]
else:
scripts = []
data_files = []
]
if __name__ == '__main__':
setup(

@ -27,18 +27,13 @@ Approach:
3. Verify checksums.
"""
from __future__ import with_statement, print_function
from urllib.error import URLError, HTTPError
from urllib.parse import urlparse
from urllib.request import ProxyHandler, build_opener, urlopen
import codecs
import hashlib
import json
import os.path
try:
from urllib.request import ProxyHandler, build_opener, urlopen
from urllib.parse import urlparse
from urllib.error import URLError, HTTPError
except ImportError:
from urllib2 import ProxyHandler, build_opener, urlopen, URLError, HTTPError
from urlparse import urlparse
import re
import sys
@ -496,15 +491,6 @@ class DebianSourcePackage(SourcePackage):
def snapshot_list(self):
"Return a filename -> hash dictionary from snapshot.debian.org"
if self._snapshot_list is None:
try:
import json
except ImportError:
import simplejson as json
except ImportError:
Logger.error("Please install python-simplejson.")
raise DownloadError("Unable to dowload from "
"snapshot.debian.org without "
"python-simplejson")
try:
data = self.url_opener.open(

@ -49,8 +49,7 @@ def get_source_files():
if is_script:
with open(code_file, "rb") as script_file:
shebang = script_file.readline().decode("utf-8")
if ((sys.version_info[0] == 3 and "python3" in shebang)
or ("python" in shebang and "python3" not in shebang)):
if "python3" in shebang:
files.append(code_file)
else:
files.append(code_file)