33import sys
44
55from typing import Optional , List
6+ import subprocess
67from subprocess import CalledProcessError , check_call
78
89from .Check import Check
9- from ci_tools .functions import install_into_venv
10+ from ci_tools .functions import install_into_venv , get_pip_command
1011from ci_tools .scenario .generation import create_package_and_install
1112from ci_tools .variables import discover_repo_root , in_ci , set_envvar_defaults
1213from ci_tools .environment_exclusions import is_check_enabled
13- from ci_tools .logging import logger
14+ from ci_tools .logging import logger , run_logged
1415
1516REPO_ROOT = discover_repo_root ()
1617PYLINT_VERSION = "3.2.7"
@@ -48,6 +49,7 @@ def run(self, args: argparse.Namespace) -> int:
4849 package_name = parsed .name
4950 executable , staging_directory = self .get_executable (args .isolate , args .command , sys .executable , package_dir )
5051 logger .info (f"Processing { package_name } for pylint check" )
52+ pip_cmd = get_pip_command (executable )
5153
5254 # install dependencies
5355 self .install_dev_reqs (executable , args , package_dir )
@@ -64,7 +66,7 @@ def run(self, args: argparse.Namespace) -> int:
6466 cache_dir = None ,
6567 work_dir = staging_directory ,
6668 force_create = False ,
67- package_type = "wheel " ,
69+ package_type = "sdist " ,
6870 pre_download_disabled = False ,
6971 python_executable = executable ,
7072 )
@@ -80,6 +82,19 @@ def run(self, args: argparse.Namespace) -> int:
8082 logger .error (f"Failed to install pylint: { e } " )
8183 return e .returncode
8284
85+ # debug a pip freeze result
86+ cmd = pip_cmd + ["freeze" ]
87+ freeze_result = subprocess .run (
88+ cmd ,
89+ cwd = package_dir ,
90+ check = False ,
91+ text = True ,
92+ stdout = subprocess .PIPE ,
93+ stderr = subprocess .STDOUT
94+ )
95+ logger .debug (f"Running pip freeze with { cmd } " )
96+ logger .debug (freeze_result .stdout )
97+
8398 top_level_module = parsed .namespace .split ("." )[0 ]
8499
85100 if in_ci ():
@@ -92,6 +107,15 @@ def run(self, args: argparse.Namespace) -> int:
92107 rcFileLocation = os .path .join (REPO_ROOT , "eng/pylintrc" ) if args .next else os .path .join (REPO_ROOT , "pylintrc" )
93108
94109 try :
110+ logger .info ([
111+ executable ,
112+ "-m" ,
113+ "pylint" ,
114+ "--rcfile={}" .format (rcFileLocation ),
115+ "--output-format=parseable" ,
116+ os .path .join (package_dir , top_level_module ),
117+ ])
118+
95119 results .append (check_call (
96120 [
97121 executable ,
0 commit comments