Skip to content

Commit

Permalink
Clean useless python 2 home paths (#31486)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Lopez <[email protected]>
  • Loading branch information
Pythyu and alopezz authored Nov 28, 2024
1 parent b80f86c commit 83246bd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 17 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ To build the Agent you need:
**Note:** you may want to use a python virtual environment to avoid polluting your
system-wide python environment with the agent build/dev dependencies. You can
create a virtual environment using `virtualenv` and then use the `invoke agent.build`
parameters `--python-home-2=<venv_path>` and/or `--python-home-3=<venv_path>`
(depending on the python versions you are using) to use the virtual environment's
parameters `--python-home-3=<venv_path>` to use the virtual environment's
interpreter and libraries. By default, this environment is only used for dev dependencies
listed in `requirements.txt`.

Expand All @@ -55,7 +54,6 @@ To start working on the Agent, you can build the `main` branch:
virtualenvs):

invoke agent.build \
--python-home-2=$GOPATH/src/github.com/DataDog/datadog-agent/venv2 \
--python-home-3=$GOPATH/src/github.com/DataDog/datadog-agent/venv3

Running `invoke agent.build`:
Expand Down
8 changes: 2 additions & 6 deletions omnibus/config/software/datadog-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
env["GOROOT"] = msgoroot
env["PATH"] = "#{msgoroot}/bin:#{env['PATH']}"
end
default_install_dir = "/opt/datadog-agent"
if Omnibus::Config.host_distribution == "ociru"
default_install_dir = "#{install_dir}"
end

# we assume the go deps are already installed before running omnibus
if windows_target?
Expand All @@ -92,10 +88,10 @@
if linux_target?
include_sds = "--include-sds" # we only support SDS on Linux targets for now
end
command "inv -e agent.build --exclude-rtloader #{include_sds} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{default_install_dir}/embedded --python-home-2=#{default_install_dir}/embedded --python-home-3=#{default_install_dir}/embedded --flavor #{flavor_arg}", env: env
command "inv -e agent.build --exclude-rtloader #{include_sds} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded --flavor #{flavor_arg}", env: env

if heroku_target?
command "inv -e agent.build --exclude-rtloader --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded --python-home-2=#{install_dir}/embedded --python-home-3=#{install_dir}/embedded --flavor #{flavor_arg} --agent-bin=bin/agent/core-agent", env: env
command "inv -e agent.build --exclude-rtloader --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded --flavor #{flavor_arg} --agent-bin=bin/agent/core-agent", env: env
end
end

Expand Down
2 changes: 0 additions & 2 deletions tasks/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def build(
install_path=None,
embedded_path=None,
rtloader_root=None,
python_home_2=None,
python_home_3=None,
major_version='7',
exclude_rtloader=False,
Expand Down Expand Up @@ -164,7 +163,6 @@ def build(
install_path=install_path,
embedded_path=embedded_path,
rtloader_root=rtloader_root,
python_home_2=python_home_2,
python_home_3=python_home_3,
major_version=major_version,
)
Expand Down
2 changes: 0 additions & 2 deletions tasks/gotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ def test(
race=False,
profile=False,
rtloader_root=None,
python_home_2=None,
python_home_3=None,
cpus=None,
major_version='7',
Expand Down Expand Up @@ -303,7 +302,6 @@ def test(
ldflags, gcflags, env = get_build_flags(
ctx,
rtloader_root=rtloader_root,
python_home_2=python_home_2,
python_home_3=python_home_3,
major_version=major_version,
)
Expand Down
3 changes: 0 additions & 3 deletions tasks/libs/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def get_build_flags(
run_path=None,
embedded_path=None,
rtloader_root=None,
python_home_2=None,
python_home_3=None,
major_version='7',
headless_mode=False,
Expand Down Expand Up @@ -243,8 +242,6 @@ def get_build_flags(
ldflags += f"-X {REPO_PATH}/pkg/config/setup.defaultRunPath={run_path} "

# setting python homes in the code
if python_home_2:
ldflags += f"-X {REPO_PATH}/pkg/collector/python.pythonHome2={python_home_2} "
if python_home_3:
ldflags += f"-X {REPO_PATH}/pkg/collector/python.pythonHome3={python_home_3} "

Expand Down
2 changes: 1 addition & 1 deletion tasks/winbuildscripts/unittests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if($err -ne 0){
Write-Host -ForegroundColor Red "Agent build failed $err"
[Environment]::Exit($err)
}
& inv -e test --junit-tar="$Env:JUNIT_TAR" --race --profile --rerun-fails=2 --coverage --cpus 8 --python-home-2=$Env:Python2_ROOT_DIR --python-home-3=$Env:Python3_ROOT_DIR --save-result-json C:\mnt\$test_output_file $Env:EXTRA_OPTS --build-stdlib $TEST_WASHER_FLAG
& inv -e test --junit-tar="$Env:JUNIT_TAR" --race --profile --rerun-fails=2 --coverage --cpus 8 --python-home-3=$Env:Python3_ROOT_DIR --save-result-json C:\mnt\$test_output_file $Env:EXTRA_OPTS --build-stdlib $TEST_WASHER_FLAG
If ($LASTEXITCODE -ne "0") {
exit $LASTEXITCODE
}
Expand Down

0 comments on commit 83246bd

Please sign in to comment.