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

Support Python 3 #2738

Merged
merged 3 commits into from
Dec 13, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- stage: test
env: CHECK=fluentd
- stage: test
env: CHECK=gearmand
env: CHECK=gearmand PYTHON3=true
- stage: test
env: CHECK=gitlab
- stage: test
Expand Down
11 changes: 8 additions & 3 deletions gearmand/datadog_checks/gearmand/gearmand.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)

# 3rd party
import gearman
from six import PY2

# project
from datadog_checks.checks import AgentCheck

# Python 3 compatability is a different library
# It's a drop in replacement but has a different name
# This will enable the check to use the new library
if PY2:
import gearman
else:
import python3_gearman as gearman

MAX_NUM_TASKS = 200

Expand Down
1 change: 1 addition & 0 deletions gearmand/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
gearman==2.0.2; sys_platform != 'win32' and python_version < '3.0'
python3-gearman==0.1.0; sys_platform != 'win32' and python_version > '3.0'
7 changes: 6 additions & 1 deletion gearmand/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
#
# pip-compile --generate-hashes --output-file requirements.txt requirements.in
#
gearman==2.0.2 \

gearman==2.0.2 ; sys_platform != "win32" and python_version < "3.0" \
--hash=sha256:2b1876a60e32e24bed4c6d187898274de6409bbfa942bcbe3512efdf2aed0ec9

python3-gearman==0.1.0 ; sys_platform != "win32" and python_version > "3.0" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we bumping the req in the root agent-req file now or when release happens?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it now pls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmuesch I bumped the requirements file, can you rereview

--hash=sha256:3ee44df221587c76ff13f0bebf4923b02b31b1b069ffda07416658be0614865c \
--hash=sha256:4a5808d3a0bfc6c243548ad57e7aab4bee62c9cba2b1c3a860fdd292d46a112d
4 changes: 1 addition & 3 deletions gearmand/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
minversion = 2.0
basepython = py27
envlist =
gearmand
{py27,py36}-gearmand
flake8

[testenv]
Expand All @@ -14,8 +14,6 @@ deps =
passenv =
COMPOSE*
DOCKER*

[testenv:gearmand]
commands =
pip install --require-hashes -r requirements.txt
pytest -v
Expand Down