Skip to content

Commit

Permalink
Fix metadata tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
stealthycoin committed Oct 24, 2022
1 parent 9b05024 commit 7b82114
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backends/build_system/awscli_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import os
import json
import subprocess
import site
import sys
Expand Down Expand Up @@ -133,15 +134,18 @@ def _pip_install(self, args, cwd=None):
self._utils.run(args, **run_kwargs)

def _site_packages(self) -> str:
site_path = (
# On windows the getsitepackages can return the root venv dir.
# So instead of just taking the first entry, we need to take the
# first entry that contains the string "site-packages" in the path.
site_path = [path for path in json.loads(
subprocess.check_output(
[
self.python_exe,
"-c",
"import site; print(site.getsitepackages()[0])",
"import site, json; print(json.dumps(site.getsitepackages()))",
]
)
.decode()
.strip()
)
) if "site-packages" in path][0]
return site_path

0 comments on commit 7b82114

Please sign in to comment.