Jinmo / idapkg

Packages for IDA Pro (written in python but supports all)
MIT License
131 stars 16 forks source link

To add python/ to sys.path or not to add, that is the question #5

Open Jinmo opened 5 years ago

Jinmo commented 5 years ago

Currently idapkg adds package root to sys.path, and I'm not sure if it's a good way.

Some path candidates that can be added to sys.path (but not sure what's best):

- idapkg/packages
- idapkg/packages/<package root> (current)
- idapkg/packages/<package root>/python

IDAPython adds <IDA installation path>/python to sys.path by default, and some plugins use this scheme in deployment. (e.g. Ghidra <-> IDA converter) One can just move python/* to package root, but I'm not sure if this is a good way. (It works, and doesn't conflict commonly, but if some files like setup.py exists and some package uses import setup or etc, it does matter.)

Here, I like the approach of idaenv which tries to wrap all packages as a python (ex. IDArling supports idaenv). Using setup.py or other setuptools/distutils module enables reusing python's package management system. (One can pip install ./idarling/ or etc though)