File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,14 @@ class BundleException(Exception):
2323
2424class Bundle :
2525 def __init__ (self , bundle_path : Path ) -> None :
26- self .tmp_dir = None
26+ self .tmp_dir = TemporaryDirectory ()
2727 if bundle_path .is_dir ():
28- self .bundle_path = bundle_path
28+ self .bundle_path = Path (self .tmp_dir .name ) / bundle_path .name
29+ shutil .copytree (
30+ bundle_path ,
31+ self .bundle_path ,
32+ )
2933 elif bundle_path .is_file () and bundle_path .name .endswith (".tar.gz" ):
30- self .tmp_dir = TemporaryDirectory ()
3134 logging .info (
3235 f"Unpacking provided bundle { bundle_path } to { self .tmp_dir .name } ."
3336 )
@@ -40,6 +43,8 @@ def __init__(self, bundle_path: Path) -> None:
4043 self .codeql = CodeQL (self .bundle_path / "codeql" )
4144 try :
4245 logging .info (f"Validating the CodeQL CLI version part of the bundle." )
46+ unpacked_location = self .codeql .unpacked_location ()
47+ logging .debug (f"Found CodeQL CLI in { str (unpacked_location )} ." )
4348 version = self .codeql .version ()
4449 logging .info (f"Found CodeQL CLI version { version } ." )
4550 except CodeQLException :
Original file line number Diff line number Diff line change @@ -83,6 +83,14 @@ def version(self) -> Version:
8383 else :
8484 raise CodeQLException (f"Failed to run { cp .args } command!" )
8585
86+ def unpacked_location (self ) -> Path :
87+ cp = self ._exec ("version" , "--format=json" )
88+ if cp .returncode == 0 :
89+ version_info = json .loads (cp .stdout )
90+ return Path (version_info ["unpackedLocation" ])
91+ else :
92+ raise CodeQLException (f"Failed to run { cp .args } command!" )
93+
8694 def supports_qlx (self ) -> bool :
8795 return self .version () >= Version ("2.11.4" )
8896
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " codeql-bundle"
3- version = " 0.1.3 "
3+ version = " 0.1.4 "
44description = " Tool to create custom CodeQL bundles"
55authors = [" Remco Vermeulen <rvermeulen@users.noreply.github.com>" ]
66readme = " README.md"
You can’t perform that action at this time.
0 commit comments