3
3
import sys
4
4
5
5
from typing import Optional , List
6
+ import subprocess
6
7
from subprocess import CalledProcessError , check_call
7
8
8
9
from .Check import Check
9
- from ci_tools .functions import install_into_venv
10
+ from ci_tools .functions import install_into_venv , get_pip_command
10
11
from ci_tools .scenario .generation import create_package_and_install
11
12
from ci_tools .variables import discover_repo_root , in_ci , set_envvar_defaults
12
13
from ci_tools .environment_exclusions import is_check_enabled
13
- from ci_tools .logging import logger
14
+ from ci_tools .logging import logger , run_logged
14
15
15
16
REPO_ROOT = discover_repo_root ()
16
17
PYLINT_VERSION = "3.2.7"
@@ -48,6 +49,7 @@ def run(self, args: argparse.Namespace) -> int:
48
49
package_name = parsed .name
49
50
executable , staging_directory = self .get_executable (args .isolate , args .command , sys .executable , package_dir )
50
51
logger .info (f"Processing { package_name } for pylint check" )
52
+ pip_cmd = get_pip_command (executable )
51
53
52
54
# install dependencies
53
55
self .install_dev_reqs (executable , args , package_dir )
@@ -64,7 +66,7 @@ def run(self, args: argparse.Namespace) -> int:
64
66
cache_dir = None ,
65
67
work_dir = staging_directory ,
66
68
force_create = False ,
67
- package_type = "wheel " ,
69
+ package_type = "sdist " ,
68
70
pre_download_disabled = False ,
69
71
python_executable = executable ,
70
72
)
@@ -80,6 +82,19 @@ def run(self, args: argparse.Namespace) -> int:
80
82
logger .error (f"Failed to install pylint: { e } " )
81
83
return e .returncode
82
84
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
+
83
98
top_level_module = parsed .namespace .split ("." )[0 ]
84
99
85
100
if in_ci ():
@@ -92,6 +107,15 @@ def run(self, args: argparse.Namespace) -> int:
92
107
rcFileLocation = os .path .join (REPO_ROOT , "eng/pylintrc" ) if args .next else os .path .join (REPO_ROOT , "pylintrc" )
93
108
94
109
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
+
95
119
results .append (check_call (
96
120
[
97
121
executable ,
0 commit comments