always load funfactory from vendor library #130

Merged
merged 1 commit into from Aug 28, 2012

Projects

None yet

3 participants

Owner
lonnen commented Aug 27, 2012

If funfactory exists in site-packages, it will get imported instead of the
one in vendor-lib. This was intended to be exploited by funfactory devs for
testing new version by installing them in the virtualenv, but it may catch
general developers.

This PR modifies manage.py to always load funfactory from vendor-lib. Devs
who want to run a custom funfactory can comment out a single line in
manage.py to load it from their virtualenv instead.

Contributor
peterbe commented Aug 27, 2012

r+

(remember to treat our manage.py in socorro-crashstats the same too when you're done)

@kumar303 kumar303 and 1 other commented on an outdated diff Aug 28, 2012
@@ -5,20 +5,16 @@
# Edit this if necessary or override the variable in your environment.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
-try:
- # For local development in a virtualenv:
- from funfactory import manage
-except ImportError:
- # Production:
- # Add a temporary path so that we can import the funfactory
- tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'vendor', 'src', 'funfactory')
- sys.path.append(tmp_path)
+# Add a temporary path so that we can import the funfactory
+tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'vendor', 'src', 'funfactory')
+# Comment out to load funfactory from your site packages instead
+sys.path.append(tmp_path)
kumar303
kumar303 Aug 28, 2012 Member

hmm, did this actually fix it when you had a global funfactory installed? It might need to be sys.path.insert(0, ...)

peterbe
peterbe Aug 28, 2012 Contributor

I concur. Well spotted @kumar303

Owner
lonnen commented Aug 28, 2012

Good catch Kumar. I had already fixed the issue locally with a --no-site-packages virtualenv and didn't reproduce the original issue before testing.

PR updated.

Member

Thanks, seems like it should work now.

@kumar303 kumar303 merged commit 3ca0071 into mozilla:master Aug 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment