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

Update requirements when updating check #4895

Merged
merged 2 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Use a constant
  • Loading branch information
therve committed Oct 28, 2019
commit 14a0d78584bede538c72926ab337cc8bc6906607
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from six import itervalues

from ...utils import write_file_lines
from ..constants import get_agent_requirements, get_root
from ..constants import REQUIREMENTS_IN, get_agent_requirements, get_root
from ..requirements import Package, make_catalog, read_packages, resolve_requirements
from .console import CONTEXT_SETTINGS, abort, echo_failure, echo_info, echo_success, echo_waiting, echo_warning

Expand Down Expand Up @@ -66,7 +66,7 @@ def resolve(checks, lazy, quiet):
checks = os.listdir(root)

for check_name in sorted(checks):
pinned_reqs_file = os.path.join(root, check_name, 'requirements.in')
pinned_reqs_file = os.path.join(root, check_name, REQUIREMENTS_IN)
resolved_reqs_file = os.path.join(root, check_name, 'requirements.txt')

if os.path.isfile(pinned_reqs_file):
Expand Down Expand Up @@ -107,7 +107,7 @@ def pin(package, version, checks, marker, resolving, lazy, quiet):
version = version.lower()

for check_name in sorted(os.listdir(root)):
pinned_reqs_file = os.path.join(root, check_name, 'requirements.in')
pinned_reqs_file = os.path.join(root, check_name, REQUIREMENTS_IN)
resolved_reqs_file = os.path.join(root, check_name, 'requirements.txt')

if os.path.isfile(pinned_reqs_file):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
TESTABLE_FILE_EXTENSIONS = ('.py', '.ini', '.in', '.txt', '.yml', '.yaml')
NON_TESTABLE_FILES = ('auto_conf.yaml', 'metrics.yaml')

REQUIREMENTS_IN = 'requirements.in'

ROOT = ''

Expand Down
8 changes: 4 additions & 4 deletions datadog_checks_dev/datadog_checks/dev/tooling/e2e/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ...subprocess import run_command
from ...utils import file_exists, path_join
from ..constants import get_root
from ..constants import REQUIREMENTS_IN, get_root
from .agent import (
DEFAULT_AGENT_VERSION,
DEFAULT_PYTHON_VERSION,
Expand Down Expand Up @@ -178,15 +178,15 @@ def update_check(self):
command = ['docker', 'exec', self.container_name]
command.extend(get_pip_exe(self.python_version))
command.extend(('install', '-e', self.check_mount_dir))
if file_exists(path_join(get_root(), self.check, 'requirements.in')):
command.extend(('-r', path_join(self.check_mount_dir, 'requirements.in')))
if file_exists(path_join(get_root(), self.check, REQUIREMENTS_IN)):
command.extend(('-r', path_join(self.check_mount_dir, REQUIREMENTS_IN)))
run_command(command, capture=True, check=True)

def update_base_package(self):
command = ['docker', 'exec', self.container_name]
command.extend(get_pip_exe(self.python_version))
command.extend(('install', '-e', self.base_mount_dir))
command.extend(('-r', path_join(self.base_mount_dir, 'requirements.in')))
command.extend(('-r', path_join(self.base_mount_dir, REQUIREMENTS_IN)))
run_command(command, capture=True, check=True)

def update_agent(self):
Expand Down
8 changes: 4 additions & 4 deletions datadog_checks_dev/datadog_checks/dev/tooling/e2e/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ...structures import EnvVars
from ...subprocess import run_command
from ...utils import ON_LINUX, ON_MACOS, ON_WINDOWS, file_exists, path_join
from ..constants import get_root
from ..constants import REQUIREMENTS_IN, get_root
from .agent import (
DEFAULT_AGENT_VERSION,
DEFAULT_PYTHON_VERSION,
Expand Down Expand Up @@ -172,14 +172,14 @@ def update_check(self):
command = get_pip_exe(self.python_version, self.platform)
path = path_join(get_root(), self.check)
command.extend(('install', '-e', path))
if file_exists(path_join(path, 'requirements.in')):
command.extend(('-r', path_join(path, 'requirements.in')))
if file_exists(path_join(path, REQUIREMENTS_IN)):
command.extend(('-r', path_join(path, REQUIREMENTS_IN)))
return run_command(command, capture=True, check=True)

def update_base_package(self):
command = get_pip_exe(self.python_version, self.platform)
command.extend(('install', '-e', self.base_package))
command.extend(('-r', path_join(self.base_package, 'requirements.in')))
command.extend(('-r', path_join(self.base_package, REQUIREMENTS_IN)))
return run_command(command, capture=True, check=True)

def update_agent(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from ..subprocess import run_command
from ..utils import chdir, resolve_path, stream_file_lines, write_file_lines
from .constants import get_root
from .constants import REQUIREMENTS_IN, get_root

DEP_PATTERN = re.compile(r'([^=]+)(?:==([^;\s]+)(?:; *(.*))?)?')

Expand Down Expand Up @@ -181,7 +181,7 @@ def make_catalog(verify=False, checks=None):
checks = checks if checks else os.listdir(root)

for check_name in sorted(checks):
for package in read_packages(os.path.join(root, check_name, 'requirements.in')):
for package in read_packages(os.path.join(root, check_name, REQUIREMENTS_IN)):
if not package.version:
errors.append('Unpinned dependency `{}` in the `{}` check'.format(package.name, check_name))
catalog.add_package(check_name, package)
Expand Down