File tree Expand file tree Collapse file tree 5 files changed +509
-230
lines changed Expand file tree Collapse file tree 5 files changed +509
-230
lines changed Original file line number Diff line number Diff line change 99XlsxWriter
1010PyYAML
1111fosslight_util >= 2.1.13
12- dependency-check
Original file line number Diff line number Diff line change 66import os
77import shutil
88from setuptools import setup , find_packages
9+ from setuptools .command .install import install
10+
11+ class PostInstallCommand (install ):
12+ """Post-installation for installation mode."""
13+ def run (self ):
14+ install .run (self )
15+ # Install syft and grype after package installation
16+ try :
17+ from src .fosslight_binary ._jar_analysis import ensure_syft_grype
18+ print ("Installing syft and grype..." )
19+ ensure_syft_grype ()
20+ print ("Syft and grype installation completed." )
21+ except Exception as e :
22+ print (f"Warning: Failed to auto-install syft/grype: { e } " )
23+ print ("You can install them manually or they will be installed on first use." )
924
1025with open ('README.md' , 'r' , 'utf-8' ) as f :
1126 readme = f .read ()
6378 },
6479 package_data = {_PACKAEG_NAME : [os .path .join (_LICENSE_DIR , '*' )]},
6580 include_package_data = True ,
81+ cmdclass = {
82+ 'install' : PostInstallCommand ,
83+ },
6684 entry_points = {
6785 "console_scripts" : [
6886 "binary_analysis = fosslight_binary.cli:main" ,
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+ # Copyright (c) 2025 LG Electronics Inc.
4+ # SPDX-License-Identifier: Apache-2.0
5+
6+ # Auto-install syft and grype on first import
7+ import logging
8+ import os
9+
10+ logger = logging .getLogger (__name__ )
11+
12+ def _auto_install_dependencies ():
13+ """Auto-install syft and grype if not available"""
14+ try :
15+ from ._jar_analysis import ensure_syft_grype
16+ # Only try to install if we're not in a restricted environment
17+ if not os .environ .get ('FOSSLIGHT_SKIP_AUTO_INSTALL' ):
18+ ensure_syft_grype ()
19+ except Exception as ex :
20+ # Don't fail package import if auto-install fails
21+ logger .debug (f"Auto-install failed (this is not critical): { ex } " )
22+
23+ # Run auto-install on import
24+ _auto_install_dependencies ()
You can’t perform that action at this time.
0 commit comments