mharbison72 added a comment.

  In https://phab.mercurial-scm.org/D5025#75556, @yuja wrote:
  
  > >   def perfstartup(ui, repo, **opts):
  > >       opts = _byteskwargs(opts)
  > >       timer, fm = gettimer(ui, opts)
  > > 
  > > - cmd = sys.argv[0] +    cmd = fsencode(sys.argv[0])
  >
  > Applying fsencode() on sys.argv is probably wrong on Windows, but it's 
perf.py,
  >  I don't care.
  
  
  Sadly, it doesn't work on Windows.  But since os.system() is called with an 
r-string, bytes wouldn't be right anyway.  When I simply formatted in 
sys.argv[0], I got this:
  
    --- c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t
    +++ c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t.err
    @@ -184,6 +184,7 @@
       $ hg perfrevrange
       $ hg perfrevset 'all()'
       $ hg perfstartup
    +  (null): can't open file '<unprintable file name>': [Errno 2] $ENOENT$
       $ hg perfstatus
       $ hg perftags
       $ hg perftemplating
  
  This will be good to figure out because there are ~400 other instances of 
this error, mostly around launching hooks.  What I've found to work (both here 
and for the hooks) is to make sure that python3 is launched:
  
    os.system(r"py -3 %s version -q > NUL" % sys.argv[0])
  
  It's perfectly capable of running `r'notepad'`, so this must be an 
hg.exe/python.exe issue.  This probably gets messy (at least with the hooks) 
because *.py files are associated with python2, and python2 is in $PATH (but 
not python3- both of which are named python.exe).  `py -3` will also pay 
attention to the shbang line, all of which are coded to python2.  The only 
other thing of note that I see is that wrapper.exe implements main() and not 
wmain(), but I can't believe that py3 is incapable of launching things built 
without Unicode support.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5025

To: pulkit, #hg-reviewers
Cc: mharbison72, yuja, mjpieters, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to