[py3porters-devel] Porting reportbug to Python 3

Berker Peksağ berker.peksag at gmail.com
Mon Jun 1 15:38:24 UTC 2015


On Mon, Jun 1, 2015 at 4:49 PM, Florian Bruhin <me at the-compiler.org> wrote:
> * Thomas Goirand <zigo at debian.org> [2015-06-01 10:37:46 +0200]:
>> Your comments are welcome, and as well, anyone from the py3porters team
>> is more than welcome to review my patch.
>
> I hope the ML is the right place for this - I did a quick look at the
> patch and added some thoughts below.
>
> Also, is it desirable to keep python2 compatibility?
>
>> diff --git a/bin/reportbug b/bin/reportbug
>> index 969e798..7ccdeab 100755
>> --- a/bin/reportbug
>> +++ b/bin/reportbug
>> @@ -21,19 +21,34 @@
>>  ##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
>>  ##  SOFTWARE.
>>
>> +from __future__ import print_function
>> +
>>  DEFAULT_BTS = 'debian'
>>
>>  import sys
>>
>> -reload(sys)
>> -sys.setdefaultencoding("utf-8")
>> +try:
>> +    reload(sys)
>> +except:
>> +    from imp import reload
>> +    reload(sys)

Also, unless I'm missing something, you won't need this hack in Python
3. So it could be guarded with a ``if PY2:`` branch.

--Berker



More information about the py3porters-devel mailing list