[+ dev-webapps]

On Aug 5, 2013, at 2:57 PM, Matt Basta <[email protected]> wrote:

> Hey all
> 
> Up until now, one of the requirements for the mozilla/amo-validator and 
> mozilla/app-validator has been having a local installation of Spidermonkey. 
> Spidermonkey is fairly slow, though, and we're considering migrating the 
> app-validator to use UglifyJS (in Node) instead.
> 
> The question is, what's the best way to make this a dependency? The naive 
> approach is to simply say "have uglify installed" in the Getting Started 
> docs. Has anyone ever tried adding `npm install` commands to their setup.py 
> file? Is there a library which makes this easier?
> 
> Note that the these projects are installed via pip (as eggs) and not manually 
> cloned/installed. Also, porting the app-validator codebase to JS is out of 
> the question.
> 
> 
> Thoughts and comments welcome! I'd love to know how others have gotten around 
> this.
> 
> -basta


I'm not sure if it's the best way but you could include the static files using 
setuptools and MANIFEST.in 
http://stackoverflow.com/questions/11848030/how-include-static-files-to-setuptools-python-package
 Then (IIRC) you could find the path at runtime with something like 
pkg_resources.resource_filename('app-validator', 'node_modules/bin/uglify.js') 
http://pythonhosted.org/distribute/pkg_resources.html#resource-extraction You 
may also find the manifest checker helpful since setup.py likes to ignore 
formatting errors: https://pypi.python.org/pypi/check-manifest/

I personally wouldn't try to roll all this into setup.py. I would just have the 
code check for the executable on os.getenv('PATH') and if it's not there, raise 
an informative exception.

+1 for not depending on all of Spidermonkey.

-Kumar
_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to