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

Bug#766752: python-socksipy: Please add support for python3



tags 766752 + patch
thank you

Attached is a small patch "unicode_domain" for supporting unicode
destination addresses. The package works in python3 after that. :)

Also attached is a complete diff of debian/ for generating the new
binary package (that patch includes the first one).
Description: Allows destination address to be unicode
 .
 This allows the package to run using python3.
Author: Jean-Michel Nirgal Vourgère <jmv_deb@nirgal.com>
Bug-Debian: https://bugs.debian.org/766752
Forwarded: no
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2014-10-25

Index: python-socksipy-1.02/socks.py
===================================================================
--- python-socksipy-1.02.orig/socks.py
+++ python-socksipy-1.02/socks.py
@@ -212,7 +212,12 @@ class socksocket(socket.socket):
             if self.__proxy[3]:
                 # Resolve remotely
                 ipaddr = None
-                req = req + chr(0x03).encode() + chr(len(destaddr)).encode() + destaddr
+                if type(destaddr) != type(b''): # python3
+                    destaddr_bytes = destaddr.encode()
+                    # TODO: support "xn--" prefixes as defined by RFC 3490
+                else:
+                    destaddr_bytes = destaddr
+                req = req + chr(0x03).encode() + chr(len(destaddr_bytes)).encode() + destaddr_bytes
             else:
                 # Resolve locally
                 ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
diff -Naur orig/python-socksipy-1.02/debian/changelog python-socksipy-1.02/debian/changelog
--- orig/python-socksipy-1.02/debian/changelog	2014-10-13 14:07:57.000000000 +0200
+++ python-socksipy-1.02/debian/changelog	2014-10-25 16:20:20.233370003 +0200
@@ -1,3 +1,14 @@
+python-socksipy (1.02-1.1) UNRELEASED; urgency=low
+
+  * QA upload.
+  * Add support for python3: (Closes: #766752)
+    - New patch unicode_domain for unicode destination address, which is python3
+      default.
+    - New python3-socksipy binary package in control
+    - Updated debian/rules for python2 + python3 packages.
+
+ -- Jean-Michel Nirgal Vourgère <jmv_deb@nirgal.com>  Sat, 25 Oct 2014 14:07:43 +0200
+
 python-socksipy (1.02-1) unstable; urgency=medium
 
   [ Jari Aalto ]
diff -Naur orig/python-socksipy-1.02/debian/control python-socksipy-1.02/debian/control
--- orig/python-socksipy-1.02/debian/control	2014-10-13 14:07:57.000000000 +0200
+++ python-socksipy-1.02/debian/control	2014-10-25 15:01:19.666880971 +0200
@@ -3,16 +3,31 @@
 Priority: optional
 Maintainer: Debian QA Group <packages@qa.debian.org>
 Standards-Version: 3.9.4
-Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), dh-python
+Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python3, dh-python
 Homepage: http://socksipy.sourceforge.net/
 Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/python-socksipy/trunk/
 Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/python-socksipy/trunk/
+X-Python-Version: >= 2.6
+X-Python3-Version: >= 3.2
 
 Package: python-socksipy
 Architecture: all
 Depends: ${python:Depends}, ${misc:Depends}
-Description: Python SOCKS client module
+Description: Python 2 SOCKS client module
  This module was designed to allow developers of Python
  software that uses the Internet or another TCP/IP-based
  network to add support for connection through a SOCKS proxy
  server with as much ease as possible.
+ .
+ This is the Python 2 version.
+
+Package: python3-socksipy
+Architecture: all
+Depends: ${python:Depends}, ${misc:Depends}
+Description: Python 3 SOCKS client module
+ This module was designed to allow developers of Python
+ software that uses the Internet or another TCP/IP-based
+ network to add support for connection through a SOCKS proxy
+ server with as much ease as possible.
+ .
+ This is the Python 3 version.
diff -Naur orig/python-socksipy-1.02/debian/docs python-socksipy-1.02/debian/docs
--- orig/python-socksipy-1.02/debian/docs	2014-10-13 14:01:54.000000000 +0200
+++ python-socksipy-1.02/debian/docs	1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-README
-BUGS
diff -Naur orig/python-socksipy-1.02/debian/patches/series python-socksipy-1.02/debian/patches/series
--- orig/python-socksipy-1.02/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/patches/series	2014-10-25 15:53:36.792382558 +0200
@@ -0,0 +1 @@
+unicode_domain
diff -Naur orig/python-socksipy-1.02/debian/patches/unicode_domain python-socksipy-1.02/debian/patches/unicode_domain
--- orig/python-socksipy-1.02/debian/patches/unicode_domain	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/patches/unicode_domain	2014-10-25 16:14:22.078009666 +0200
@@ -0,0 +1,27 @@
+Description: Allows destination address to be unicode
+ .
+ This allows the package to run using python3.
+Author: Jean-Michel Nirgal Vourgère <jmv_deb@nirgal.com>
+Bug-Debian: https://bugs.debian.org/766752
+Forwarded: no
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: 2014-10-25
+
+Index: python-socksipy-1.02/socks.py
+===================================================================
+--- python-socksipy-1.02.orig/socks.py
++++ python-socksipy-1.02/socks.py
+@@ -212,7 +212,12 @@ class socksocket(socket.socket):
+             if self.__proxy[3]:
+                 # Resolve remotely
+                 ipaddr = None
+-                req = req + chr(0x03).encode() + chr(len(destaddr)).encode() + destaddr
++                if type(destaddr) != type(b''): # python3
++                    destaddr_bytes = destaddr.encode()
++                    # TODO: support "xn--" prefixes as defined by RFC 3490
++                else:
++                    destaddr_bytes = destaddr
++                req = req + chr(0x03).encode() + chr(len(destaddr_bytes)).encode() + destaddr_bytes
+             else:
+                 # Resolve locally
+                 ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
diff -Naur orig/python-socksipy-1.02/debian/python3-socksipy.docs python-socksipy-1.02/debian/python3-socksipy.docs
--- orig/python-socksipy-1.02/debian/python3-socksipy.docs	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/python3-socksipy.docs	2014-10-13 14:01:54.000000000 +0200
@@ -0,0 +1,2 @@
+README
+BUGS
diff -Naur orig/python-socksipy-1.02/debian/python3-socksipy.install python-socksipy-1.02/debian/python3-socksipy.install
--- orig/python-socksipy-1.02/debian/python3-socksipy.install	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/python3-socksipy.install	2014-10-25 14:42:00.602627382 +0200
@@ -0,0 +1 @@
+usr/lib/python3/*-packages/*
diff -Naur orig/python-socksipy-1.02/debian/python-socksipy.docs python-socksipy-1.02/debian/python-socksipy.docs
--- orig/python-socksipy-1.02/debian/python-socksipy.docs	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/python-socksipy.docs	2014-10-25 16:33:33.217686510 +0200
@@ -0,0 +1,2 @@
+README
+BUGS
diff -Naur orig/python-socksipy-1.02/debian/python-socksipy.install python-socksipy-1.02/debian/python-socksipy.install
--- orig/python-socksipy-1.02/debian/python-socksipy.install	1970-01-01 01:00:00.000000000 +0100
+++ python-socksipy-1.02/debian/python-socksipy.install	2014-10-25 14:41:33.166052320 +0200
@@ -0,0 +1 @@
+usr/lib/python2.*/*-packages/*
diff -Naur orig/python-socksipy-1.02/debian/rules python-socksipy-1.02/debian/rules
--- orig/python-socksipy-1.02/debian/rules	2014-10-13 14:07:57.000000000 +0200
+++ python-socksipy-1.02/debian/rules	2014-10-25 16:39:21.000844149 +0200
@@ -1,4 +1,21 @@
 #!/usr/bin/make -f
 
 %:
-	dh $@ --with python2
+	dh $@ --with python2,python3
+
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -rf build
+
+override_dh_auto_build:
+	dh_auto_build
+	set -ex; for python in $(shell py3versions -r); do \
+		$$python setup.py build --build-lib=$(CURDIR)/debian/tmp; \
+	done;
+
+override_dh_auto_install:
+	dh_auto_install
+	set -ex; for python in $(shell py3versions -r); do \
+		$$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
+	done;
+	cp socks.py $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: