cycode 3.17.1.dev10__py3-none-any.whl → 3.17.1.dev11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cycode/__init__.py CHANGED
@@ -5,4 +5,4 @@ import time as _time
5
5
  # end-to-end scan duration from the moment the user actually triggered it.
6
6
  _BOOT_WALL: float = _time.time()
7
7
 
8
- __version__ = '3.17.1.dev10' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
8
+ __version__ = '3.17.1.dev11' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import platform
2
3
  import re
3
4
  from typing import Optional
4
5
 
@@ -12,19 +13,32 @@ from cycode.cli.utils.shell_executor import shell
12
13
  BUILD_GRADLE_FILE_NAME = 'build.gradle'
13
14
  BUILD_GRADLE_KTS_FILE_NAME = 'build.gradle.kts'
14
15
  BUILD_GRADLE_DEP_TREE_FILE_NAME = 'gradle-dependencies-generated.txt'
15
- BUILD_GRADLE_ALL_PROJECTS_COMMAND = ['gradle', 'projects']
16
16
  ALL_PROJECTS_REGEX = r"[+-]{3} Project '(.*?)'"
17
17
 
18
+ GRADLE_EXECUTABLE = 'gradle'
19
+ GRADLEW_FILE_NAME = 'gradlew'
20
+ GRADLEW_BAT_FILE_NAME = 'gradlew.bat'
21
+
18
22
 
19
23
  class RestoreGradleDependencies(BaseRestoreDependencies):
20
24
  def __init__(
21
25
  self, ctx: typer.Context, is_git_diff: bool, command_timeout: int, projects: Optional[set[str]] = None
22
26
  ) -> None:
23
27
  super().__init__(ctx, is_git_diff, command_timeout, create_output_file_manually=True)
28
+ self.gradle_executable = self._resolve_gradle_executable()
24
29
  if projects is None:
25
30
  projects = set()
26
31
  self.projects = self.get_all_projects() if self.is_gradle_sub_projects() else projects
27
32
 
33
+ def _resolve_gradle_executable(self) -> str:
34
+ scan_root = get_path_from_context(self.ctx)
35
+ if scan_root:
36
+ wrapper_name = GRADLEW_BAT_FILE_NAME if platform.system() == 'Windows' else GRADLEW_FILE_NAME
37
+ wrapper_path = os.path.join(scan_root, wrapper_name)
38
+ if os.path.isfile(wrapper_path):
39
+ return wrapper_path
40
+ return GRADLE_EXECUTABLE
41
+
28
42
  def is_gradle_sub_projects(self) -> bool:
29
43
  return self.ctx.obj.get('gradle_all_sub_projects', False)
30
44
 
@@ -35,7 +49,7 @@ class RestoreGradleDependencies(BaseRestoreDependencies):
35
49
  return (
36
50
  self.get_commands_for_sub_projects(manifest_file_path)
37
51
  if self.is_gradle_sub_projects()
38
- else [['gradle', 'dependencies', '-b', manifest_file_path, '-q', '--console', 'plain']]
52
+ else [[self.gradle_executable, 'dependencies', '-b', manifest_file_path, '-q', '--console', 'plain']]
39
53
  )
40
54
 
41
55
  def get_lock_file_name(self) -> str:
@@ -49,7 +63,7 @@ class RestoreGradleDependencies(BaseRestoreDependencies):
49
63
 
50
64
  def get_all_projects(self) -> set[str]:
51
65
  output = shell(
52
- command=BUILD_GRADLE_ALL_PROJECTS_COMMAND,
66
+ command=[self.gradle_executable, 'projects'],
53
67
  timeout=self.command_timeout,
54
68
  working_directory=get_path_from_context(self.ctx),
55
69
  )
@@ -62,7 +76,7 @@ class RestoreGradleDependencies(BaseRestoreDependencies):
62
76
  project_name = os.path.basename(os.path.dirname(manifest_file_path))
63
77
  project_name = f':{project_name}'
64
78
  return (
65
- [['gradle', f'{project_name}:dependencies', '-q', '--console', 'plain']]
79
+ [[self.gradle_executable, f'{project_name}:dependencies', '-q', '--console', 'plain']]
66
80
  if project_name in self.projects
67
81
  else []
68
82
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycode
3
- Version: 3.17.1.dev10
3
+ Version: 3.17.1.dev11
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  License-Expression: MIT
6
6
  License-File: LICENCE
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=UjdGx8D2pbm-DIgUO0-gvR92y-C7W85PfkiKjo0b-eg,397
1
+ cycode/__init__.py,sha256=k7ISKxt7Zq0midoKI7MS5A1C4yMJFd04wzOnraP_G-8,397
2
2
  cycode/__main__.py,sha256=Z3bD5yrA7yPvAChcADQrqCaZd0ChGI1gdiwALwbWJ6U,104
3
3
  cycode/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cycode/cli/app.py,sha256=AlR2durAEbsa47PDfIj7JtMvJDWA_Dq6wPtVuMJYSCs,10250
@@ -117,7 +117,7 @@ cycode/cli/files_collector/sca/base_restore_dependencies.py,sha256=hCQyjQW5hPhBw
117
117
  cycode/cli/files_collector/sca/go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
118
  cycode/cli/files_collector/sca/go/restore_go_dependencies.py,sha256=LXUjslfdHO3umz36WtQyRpKa_fVaRgEjewVkZ0QvnYU,1899
119
119
  cycode/cli/files_collector/sca/maven/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
- cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py,sha256=hwsdJby0_7i3s6YmCU-tB6B3TfsfbyQyeTVwEy6c6SA,2699
120
+ cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py,sha256=2W5Y8yrSIV7o4rCUtNsqO2YFImvcY5TnabzTbStiaBo,3261
121
121
  cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py,sha256=zObNN8n6yUriNVB3ZdvAkoKXXrMvzU9Lpd5lNhVo_so,4003
122
122
  cycode/cli/files_collector/sca/npm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
123
  cycode/cli/files_collector/sca/npm/restore_bun_dependencies.py,sha256=HI0X_19wCM6B_vRpX6uD12dXsQbU6LCcLQdobPZDgAs,4580
@@ -209,8 +209,8 @@ cycode/cyclient/report_client.py,sha256=Scq30NeJPzgXv0hPLO1U05AdE9i_2iu6cIrSKpEJ
209
209
  cycode/cyclient/scan_client.py,sha256=6TK5FQkfrvV7PHqRnUzEn1PBNd2oPYVamvIixcUfe3c,16755
210
210
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
211
211
  cycode/logger.py,sha256=EfZGRK6VC5rE_LAjIcRrHFiQCueylCDXoG6bvGkrIME,2111
212
- cycode-3.17.1.dev10.dist-info/METADATA,sha256=CUUCwEIh2CKhigEh5u90CphxtOsYx7vLfutsxfaTKkE,89247
213
- cycode-3.17.1.dev10.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
214
- cycode-3.17.1.dev10.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
215
- cycode-3.17.1.dev10.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
216
- cycode-3.17.1.dev10.dist-info/RECORD,,
212
+ cycode-3.17.1.dev11.dist-info/METADATA,sha256=93Wnk0yD_pEVXMMurI30p2g0IByo6L9jAD0eU006Tnk,89247
213
+ cycode-3.17.1.dev11.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
214
+ cycode-3.17.1.dev11.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
215
+ cycode-3.17.1.dev11.dist-info/licenses/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
216
+ cycode-3.17.1.dev11.dist-info/RECORD,,