LinkedInAttic/naarad

Incorrect bin path when installed with Virtualenv

Closed this issue · 3 comments

After installing naarad in a virtualenv envrironment, running the bin/naarad script silently fails when it attempts to execute PrintGCStats.

Directory layout in virtualenv:

scripts:
bin/naarad
bin/PrintGCStats

actual naarad package:
lib/python2.7/site-packages/naarad/

Where naarad thinks PrintGCStats is located:
lib/python2.7/bin/PrintGCStats

The problem is due to the line in naarad.utils where the bin_path is set based on the path of the naarad.utils module.

This path should probably be determined based on the naarad script in bin/naarad itself, since that is the execution entry point.

Note that this would also be an issue with other Python package tools such as Buildout.

@kilink Thanks for the bug report! Any chance you can submit a pull request that we can review/merge?

It seems _ _ init _ _.py (under naarad) also has one of such issue:
new_metric.bin_path = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(file)))), 'bin'))

@kilink , I think your changes work;
Would you like to change the _ _ init _ _.py also so that we can merge?
Thanks.