You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by kgiusti <gi...@git.apache.org> on 2018/05/16 17:57:39 UTC

[GitHub] qpid-dispatch pull request #305: Dispatch 965 - Port to Python 3.x

GitHub user kgiusti opened a pull request:

    https://github.com/apache/qpid-dispatch/pull/305

    Dispatch 965 - Port to Python 3.x

    This patch is about as done as I can get it.  Unit tests pass on 2.6, 2.7, and 3.6.
    
    Other than the fixups there are 2 major changes here:
    
    1) using the __futures__ modules we're enabling python 3.x features in our python 2.x environment.  IOW your python 2.x interpreter will behave like a 3.x interpreter in some cases.  Reason: unless we're using both 2.x and 3.x development environments we'll continue to break compatibility .  Forcing us to write python 3 compatible code in a python 2.x environment should help mitigate the bit rot and keep us on track for when python 2.x is dropped in ~18 months.
    
    Python 2.x behavior will change in the following ways:
    
    - the print statement is disabled - only the print() function can be used
    - all string literals are of the type unicode.  So type('foo') is now unicode, not str.  If you need a binary literal string use the 'b' prefix ala b'bintext'
    - the division operator (/) now returns a **float** rather than an integer, even if the types involved in the division are integer. IOW 4/5 now returns 0.8, not 0  (this is a nasty one - we need to be careful here)
    - module inclusion is absolute unless '.' prefix is used - we've done this for awhile so likely this won't make a difference.
    
    2) added a python linter check to the unit tests
    
    This will flag most other incompatible code changes to help avoid breaking stuff. This new test runs under the tox environment.  I urge you to install the python-tox package so you can take advantage of this test.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kgiusti/dispatch DISPATCH-965

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-dispatch/pull/305.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #305
    
----
commit 878534ec682b13cc731197318c8e6f32f06d6216
Author: Kenneth Giusti <kg...@...>
Date:   2018-04-11T21:24:23Z

    DISPATCH-965: port python code to Python 3. Stay compatible with 2.6-7

commit 7bdd55c7db7b010f204750c0e39fbc067180d26a
Author: Kenneth Giusti <kg...@...>
Date:   2018-05-14T01:11:31Z

    DISPATCH-965: fixups for Python 2.7 compatibility

commit fb363cb55411eb96667f63637d0a1cacb56df655
Author: Kenneth Giusti <kg...@...>
Date:   2018-05-16T00:56:12Z

    DISPATCH-965: restrict tox version, fixup 2.6 issues

commit a5c40dae9ac1f075c98826f1e1305cb506669672
Author: Kenneth Giusti <kg...@...>
Date:   2018-05-16T17:12:12Z

    DISPATCH-965: fix the 2.x fixes for 3.x

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #305: Dispatch 965 - Port to Python 3.x

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/qpid-dispatch/pull/305


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #305: Dispatch 965 - Port to Python 3.x

Posted by ErnieAllen <gi...@git.apache.org>.
Github user ErnieAllen commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/305#discussion_r188746296
  
    --- Diff: console/config/mock/section.py ---
    @@ -17,6 +17,11 @@
     # under the License.
     #
     
    +from __future__ import print_function
    +from __future__ import unicode_literals
    +from __future__ import division
    +from __future__ import absolute_import
    +
     import json
     import re
     from schema import Schema
    --- End diff --
    
    I think this needs to be:
    from .schema import Schema
    since the schema.py is in the same directory as the section.py file.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #305: Dispatch 965 - Port to Python 3.x

Posted by kgiusti <gi...@git.apache.org>.
Github user kgiusti commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/305#discussion_r188773750
  
    --- Diff: console/config/mock/section.py ---
    @@ -17,6 +17,11 @@
     # under the License.
     #
     
    +from __future__ import print_function
    +from __future__ import unicode_literals
    +from __future__ import division
    +from __future__ import absolute_import
    +
     import json
     import re
     from schema import Schema
    --- End diff --
    
    Good catch - I'll push a fix...


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch issue #305: Dispatch 965 - Port to Python 3.x

Posted by ChugR <gi...@git.apache.org>.
Github user ChugR commented on the issue:

    https://github.com/apache/qpid-dispatch/pull/305
  
    I ran this branch OK on two systems:
    
    * Fedora 27, Python 2.7
    * Fedora 28, Python 3.6
    
    The F27 system is my development laptop. It has python 2.6, 2.7, 3.3, 3.4, 3.4m, 3.5 3.5m, 3.6, and 3.6m. I believe that my Dispatch build runs python2.7 but to be honest I can't be sure given all the subprocesses that get launched in dispatch tests.
    
    The F28 system was carefully groomed to have only python 3.6 and 3.6m. On that system I'm confident that the Dispatch tests ran python 3 all the way. In particular the dispatch run-time picked up embedded python3. I did not run tox on this system. Tox wants to bring along all kinds of other versions of python and I wanted as pure of a python3-only system as I could get.
    
    Great work. Ship it.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org