Addon manager: install dependencies (#5376)
Addon Manager: Dependency Installation The Addon Manager can now attempt to use pip directly to install required packages as specified in either metadata.txt or requirements.txt files provided by AddOns. The packages are installed into FreeCAD.getUserAppDataDir()/AdditionalPythonPackages directory. Only simplified requirements.txt data is supported: any version information is stripped out, and only packages are supported (that is, no pip arguments, included files, etc.). Further, packages are checked against a list of allowed packages prior to being suggested for installation. Addon authors should submit a PR to the FreeCAD repo adding their requirements to the allowed list, for packages that are not already on the list (this is a malware-prevention mechanism).
This commit is contained in:
@@ -162,9 +162,15 @@ def InitApplications():
|
||||
|
||||
# also add these directories to the sys.path to
|
||||
# not change the old behaviour. once we have moved to
|
||||
# proper python modules this can eventuelly be removed.
|
||||
# proper python modules this can eventually be removed.
|
||||
sys.path = [ModDir] + libpaths + [ExtDir] + sys.path
|
||||
|
||||
# The AddonManager may install additional Python packages in
|
||||
# this path:
|
||||
additional_packages_path = os.path.join(FreeCAD.getUserAppDataDir(),"AdditionalPythonPackages")
|
||||
if os.path.isdir(additional_packages_path):
|
||||
sys.path.append(additional_packages_path)
|
||||
|
||||
def RunInitPy(Dir):
|
||||
InstallFile = os.path.join(Dir,"Init.py")
|
||||
if (os.path.exists(InstallFile)):
|
||||
|
||||
Reference in New Issue
Block a user