Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QPID-8631: fill_in python 3 incompatibilities in qmf/console.py #42

Merged
merged 2 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,42 @@ jobs:

- uses: actions/checkout@v3

- name: Setup python
id: python
# Python 2.7 was removed from actions/setup-python https://github.com/actions/setup-python/issues/672
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-20.04'
run: |
sudo apt install -y python2
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
id: apt-install-python

- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version == '2.7' && matrix.os == 'windows-latest'
run: |
choco install python2
id: choco-install-python
shell: pwsh

- name: Configure steps.python.outputs
run: |
if (Test-Path "${{ steps.setup-python.outputs.python-path }}") {
"python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} elseif (Test-Path C:/Python27/python.exe) {
"python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
"python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
}
id: python
shell: pwsh

# Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
# as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects

Expand Down
18 changes: 16 additions & 2 deletions management/python/lib/qmf/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

""" Console API for Qpid Management Framework """

from __future__ import absolute_import
from __future__ import print_function

import os
Expand All @@ -38,9 +39,22 @@
from qpid.util import connect, ssl, URL
from qpid.codec010 import StringCodec as Codec
from threading import Lock, Condition, Thread, Semaphore
from Queue import Queue, Empty
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
from time import time, strftime, gmtime, sleep
from cStringIO import StringIO
from io import StringIO

try:
long
except NameError:
long = int

try:
unicode
except NameError:
unicode = str

#import qpid.log
#qpid.log.enable(name="qpid.io.cmd", level=qpid.log.DEBUG)
Expand Down
Loading