Closed Bug 893878 Opened 11 years ago Closed 11 years ago

setup_development.py fails when using a virtualenv that's not activated

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ted, Unassigned)

Details

Attachments

(1 file)

If you run `/path/to/virtualenv/bin/python setup_development.py` to install the mozbase modules, it will fail trying to install psutils to the global Python install dir. If you instead activate the virtualenv (source virtualenv/bin/activate; python setup_development.py), the install works.

It would be nicer if they both worked.
https://github.com/mozilla/mozbase/blob/master/setup_development.py shells out to call easy_install for pypi deps and extra deps, so the results will be different if you have the venv's easy_install on your PATH or not.  We should instead ensure that we have the appropriate easy_install on the path, or equivalent.  E.g. os.environ['PATH'] = os.environ.get('PATH', '').rstrip(':') + os.path.dirname(os.path.abspath(sys.executable))
reproduced:

│mozbase/bin/python mozbase/src/mozbase/setup_development.py
running develop
running egg_info
writing mozfile.egg-info/PKG-INFO
writing top-level names to mozfile.egg-info/top_level.txt
writing dependency_links to mozfile.egg-info/dependency_links.txt
reading manifest file 'mozfile.egg-info/SOURCES.txt'
writing manifest file 'mozfile.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozfile.egg-link (link to .)
mozfile 0.9 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozfile
running develop
running egg_info
writing requirements to mozinfo.egg-info/requires.txt
writing mozinfo.egg-info/PKG-INFO
writing top-level names to mozinfo.egg-info/top_level.txt
writing dependency_links to mozinfo.egg-info/dependency_links.txt
writing entry points to mozinfo.egg-info/entry_points.txt
reading manifest file 'mozinfo.egg-info/SOURCES.txt'
writing manifest file 'mozinfo.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozinfo.egg-link (link to .)
mozinfo 0.5 is already the active version in easy-install.pth
Installing mozinfo script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozinfo
running develop
running egg_info
writing requirements to moztest.egg-info/requires.txt
writing moztest.egg-info/PKG-INFO
writing top-level names to moztest.egg-info/top_level.txt
writing dependency_links to moztest.egg-info/dependency_links.txt
reading manifest file 'moztest.egg-info/SOURCES.txt'
writing manifest file 'moztest.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/moztest.egg-link (link to .)
moztest 0.1 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/moztest
running develop
running egg_info
writing mozlog.egg-info/PKG-INFO
writing top-level names to mozlog.egg-info/top_level.txt
writing dependency_links to mozlog.egg-info/dependency_links.txt
reading manifest file 'mozlog.egg-info/SOURCES.txt'
writing manifest file 'mozlog.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozlog.egg-link (link to .)
mozlog 1.2 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozlog
running develop
running egg_info
writing requirements to mozcrash.egg-info/requires.txt
writing mozcrash.egg-info/PKG-INFO
writing top-level names to mozcrash.egg-info/top_level.txt
writing dependency_links to mozcrash.egg-info/dependency_links.txt
reading manifest file 'mozcrash.egg-info/SOURCES.txt'
writing manifest file 'mozcrash.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozcrash.egg-link (link to .)
mozcrash 0.7 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozcrash
running develop
running egg_info
writing ManifestDestiny.egg-info/PKG-INFO
writing top-level names to ManifestDestiny.egg-info/top_level.txt
writing dependency_links to ManifestDestiny.egg-info/dependency_links.txt
writing entry points to ManifestDestiny.egg-info/entry_points.txt
reading manifest file 'ManifestDestiny.egg-info/SOURCES.txt'
writing manifest file 'ManifestDestiny.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/ManifestDestiny.egg-link (link to .)
ManifestDestiny 0.5.6 is already the active version in easy-install.pth
Installing manifestparser script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/manifestdestiny
running develop
running egg_info
writing requirements to mozprofile.egg-info/requires.txt
writing mozprofile.egg-info/PKG-INFO
writing top-level names to mozprofile.egg-info/top_level.txt
writing dependency_links to mozprofile.egg-info/dependency_links.txt
writing entry points to mozprofile.egg-info/entry_points.txt
reading manifest file 'mozprofile.egg-info/SOURCES.txt'
writing manifest file 'mozprofile.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozprofile.egg-link (link to .)
mozprofile 0.11 is already the active version in easy-install.pth
Installing mozprofile script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozprofile
running develop
running egg_info
writing requirements to mozInstall.egg-info/requires.txt
writing mozInstall.egg-info/PKG-INFO
writing top-level names to mozInstall.egg-info/top_level.txt
writing dependency_links to mozInstall.egg-info/dependency_links.txt
writing entry points to mozInstall.egg-info/entry_points.txt
reading manifest file 'mozInstall.egg-info/SOURCES.txt'
writing manifest file 'mozInstall.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozInstall.egg-link (link to .)
mozInstall 1.6 is already the active version in easy-install.pth
Installing moz_remove_from_system script to /home/jhammel/mozbase/bin
Installing mozuninstall script to /home/jhammel/mozbase/bin
Installing mozinstall script to /home/jhammel/mozbase/bin
Installing moz_add_to_system script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozinstall
running develop
running egg_info
writing requirements to moznetwork.egg-info/requires.txt
writing moznetwork.egg-info/PKG-INFO
writing top-level names to moznetwork.egg-info/top_level.txt
writing dependency_links to moznetwork.egg-info/dependency_links.txt
reading manifest file 'moznetwork.egg-info/SOURCES.txt'
writing manifest file 'moznetwork.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/moznetwork.egg-link (link to .)
moznetwork 0.21 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/moznetwork
running develop
running egg_info
writing requirements to mozhttpd.egg-info/requires.txt
writing mozhttpd.egg-info/PKG-INFO
writing top-level names to mozhttpd.egg-info/top_level.txt
writing dependency_links to mozhttpd.egg-info/dependency_links.txt
writing entry points to mozhttpd.egg-info/entry_points.txt
reading manifest file 'mozhttpd.egg-info/SOURCES.txt'
writing manifest file 'mozhttpd.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozhttpd.egg-link (link to .)
mozhttpd 0.5 is already the active version in easy-install.pth
Installing mozhttpd script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozhttpd
running develop
running egg_info
writing requirements to mozsystemmonitor.egg-info/requires.txt
writing mozsystemmonitor.egg-info/PKG-INFO
writing top-level names to mozsystemmonitor.egg-info/top_level.txt
writing dependency_links to mozsystemmonitor.egg-info/dependency_links.txt
reading manifest file 'mozsystemmonitor.egg-info/SOURCES.txt'
writing manifest file 'mozsystemmonitor.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozsystemmonitor.egg-link (link to .)
mozsystemmonitor 0.0 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozsystemmonitor
running develop
running egg_info
writing requirements to mozdevice.egg-info/requires.txt
writing mozdevice.egg-info/PKG-INFO
writing top-level names to mozdevice.egg-info/top_level.txt
writing dependency_links to mozdevice.egg-info/dependency_links.txt
writing entry points to mozdevice.egg-info/entry_points.txt
reading manifest file 'mozdevice.egg-info/SOURCES.txt'
writing manifest file 'mozdevice.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozdevice.egg-link (link to .)
mozdevice 0.27 is already the active version in easy-install.pth
Installing sutini script to /home/jhammel/mozbase/bin
Installing dm script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozdevice
running develop
running egg_info
writing requirements to mozprocess.egg-info/requires.txt
writing mozprocess.egg-info/PKG-INFO
writing top-level names to mozprocess.egg-info/top_level.txt
writing dependency_links to mozprocess.egg-info/dependency_links.txt
writing entry points to mozprocess.egg-info/entry_points.txt
reading manifest file 'mozprocess.egg-info/SOURCES.txt'
writing manifest file 'mozprocess.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozprocess.egg-link (link to .)
mozprocess 0.11 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozprocess
running develop
running egg_info
writing requirements to mozrunner.egg-info/requires.txt
writing mozrunner.egg-info/PKG-INFO
writing top-level names to mozrunner.egg-info/top_level.txt
writing dependency_links to mozrunner.egg-info/dependency_links.txt
writing entry points to mozrunner.egg-info/entry_points.txt
reading manifest file 'mozrunner.egg-info/SOURCES.txt'
writing manifest file 'mozrunner.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozrunner.egg-link (link to .)
mozrunner 5.18 is already the active version in easy-install.pth
Installing mozrunner script to /home/jhammel/mozbase/bin

Installed /home/jhammel/mozbase/src/mozbase/mozrunner
running develop
running egg_info
writing requirements to mozb2g.egg-info/requires.txt
writing mozb2g.egg-info/PKG-INFO
writing top-level names to mozb2g.egg-info/top_level.txt
writing dependency_links to mozb2g.egg-info/dependency_links.txt
reading manifest file 'mozb2g.egg-info/SOURCES.txt'
writing manifest file 'mozb2g.egg-info/SOURCES.txt'
running build_ext
Creating /home/jhammel/mozbase/lib/python2.7/site-packages/mozb2g.egg-link (link to .)
mozb2g 0.2 is already the active version in easy-install.pth

Installed /home/jhammel/mozbase/src/mozbase/mozb2g
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-22034.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python2.7/dist-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  http://packages.python.org/distribute/easy_install.html

Please make the appropriate changes for your system and try again.

Traceback (most recent call last):
  File "mozbase/src/mozbase/setup_development.py", line 248, in <module>
    main()
  File "mozbase/src/mozbase/setup_development.py", line 240, in main
    call(['easy_install', version])
  File "/usr/lib/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['easy_install', 'psutil>=0.7.1']' returned non-zero exit status 1
Attached patch do the thingSplinter Review
just a drive by.  if this ain't good enough, i don't have any time to devote to this right now
Attachment #775748 - Flags: review?(ted)
Comment on attachment 775748 [details] [diff] [review]
do the thing

Review of attachment 775748 [details] [diff] [review]:
-----------------------------------------------------------------

This seems fine, it's basically what the activate script does anyway.
Attachment #775748 - Flags: review?(ted) → review+
pushed: https://github.com/mozilla/mozbase/commit/f9f88cc6d73d1190ab494eee3bc48c6b1ef6d8cc
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: