Bug 3073 - setup.py fails in buildhgextindex when run outside the mercurial repo
Summary: setup.py fails in buildhgextindex when run outside the mercurial repo
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-25 17:23 UTC by Tyler
Modified: 2012-05-13 04:55 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler 2011-10-25 17:23 UTC
Cannot install 1.9.3 from source or via pip. Running Windows 7 with Python 2.6.

$ python .\setup.py install
C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the sets module is 
deprecated
  import sets
running install
running build
running build_hgextindex
Traceback (most recent call last):
  File ".\setup.py", line 441, in <module>
    **extra)
  File "C:\Python26\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\install.py", line 577, in run
    self.run_command('build')
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build.py", line 134, in run
    self.run_command(cmd_name)
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File ".\setup.py", line 281, in run
    out, err = runcmd([sys.executable, '-c', code], env)
NameError: global name 'env' is not defined
Comment 1 Tyler 2011-10-25 17:37 UTC
Using the mercurial repo, it installs fine. But using pip or the .zip on 
bitbucket (https://bitbucket.org/mirror/mercurial/get/1.9.3.zip) gives errors.
Comment 2 Tyler 2011-10-25 17:43 UTC
The download from PyPI is also broken. http://pypi.python.org/pypi/Mercurial
Comment 3 kiilerix 2011-10-25 18:00 UTC
buildhgextindex in setup.py rely on 'env' as a global variable. That happens
to be ok when .hg exists.

I don't know what corner cases this code should support and if it is enough
to run with {} as env or if something else should be defined.

build_hgextindex is only run by default on windows where most people don't
have a setup for building from source anyway.

The impact of this is pretty low as build_hgextindex only is run by default
on windows where most people don't have a setup for building from source anyway.
Comment 4 Martin Geisler 2011-10-26 02:32 UTC
I guess we should just initialize env in the run method -- it's quite ugly
to rely on a global variable that's so far away.
Comment 5 Yuya Nishihara 2011-10-26 08:05 UTC
At least, env['SystemRoot'] is necessary to run any commands on Windows.

So I think runcmd() should set 'SystemRoot', and buildhgextindex.run() should 
define env = {'LANGUAGE': 'C'} instead of using the global variable.
Comment 6 kiilerix 2011-10-30 07:24 UTC
(partially?) fixed by http://www.selenic.com/hg/rev/b357a972d6cd
Comment 7 HG Bot 2011-11-01 12:00 UTC
Fixed by http://selenic.com/repo/hg/rev/eb6c0d47c3d5
Yuya Nishihara <yuya@tcha.org>
setup: set whole env for running hg even if .hg doesn't exist (issue3073)

(please test the fix)
Comment 8 Bugzilla 2012-05-12 09:24 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:24 EDT  ---

This bug was previously known as _bug_ 3073 at http://mercurial.selenic.com/bts/issue3073