`develop` command uses `execfile` which fails on Python 3

Issue #220 resolved
Victor Andrée
created an issue

I'm using distribute/pip/virtualenv to develop a Python 3 project (leges). I've got a pretty basic setup:



setup( name='leges', version='0.1dev',

packages=[ 'leges', 'leges.commands', 'leges.commands.sfs', 'leges.sfs', 'leges.sfs.db' ],

scripts=['bin/leges-sfs'], test_suite='leges.tests', ) }}}

When running python setup.py develop, a script like the following is created in my virtualenv's bin directory:



EASY-INSTALL-DEV-SCRIPT: 'leges==0.1dev','leges-sfs'

requires = 'leges==0.1dev' from pkg_resources import require; require('leges==0.1dev') del require file = '/Users/victor/programming/leges/leges/bin/leges-sfs' execfile(file) }}}

This does not work on Python 3, as execfile doesn't exist anymore. Using install (or install_scripts) copies my bin/leges-sfs script, which works. However, install_scripts does not overwrite files, so I have to do this:

$ python setup.py develop

$ rm ~/.virtualenvs/leges3.2/bin/leges-sfs

$ python setup.py install_scripts

I think the develop command should use the same script installation method as the regular install command, or at least not use execfile.

Comments (6)

  1. gagern

    2to3 fixes this in the following fashion:

    +exec(compile(open(__file__).read(), __file__, 'exec'))

    I guess that code should work for python 2 as well, so I suggest simply replacing the current line with that one. I assume you don't require a patch for that single line change, do you?

  2. Log in to comment