283 # jython is always pure |
283 # jython is always pure |
284 if 'java' in sys.platform or '__pypy__' in sys.modules: |
284 if 'java' in sys.platform or '__pypy__' in sys.modules: |
285 options.pure = True |
285 options.pure = True |
286 |
286 |
287 if options.with_hg: |
287 if options.with_hg: |
288 options.with_hg = os.path.realpath(os.path.expanduser(options.with_hg)) |
288 options.with_hg = os.path.realpath( |
|
289 os.path.expanduser(_bytespath(options.with_hg))) |
289 if not (os.path.isfile(options.with_hg) and |
290 if not (os.path.isfile(options.with_hg) and |
290 os.access(options.with_hg, os.X_OK)): |
291 os.access(options.with_hg, os.X_OK)): |
291 parser.error('--with-hg must specify an executable hg script') |
292 parser.error('--with-hg must specify an executable hg script') |
292 if not os.path.basename(options.with_hg) == 'hg': |
293 if not os.path.basename(options.with_hg) == b'hg': |
293 sys.stderr.write('warning: --with-hg should specify an hg script\n') |
294 sys.stderr.write('warning: --with-hg should specify an hg script\n') |
294 if options.local: |
295 if options.local: |
295 testdir = os.path.dirname(_bytespath(os.path.realpath(sys.argv[0]))) |
296 testdir = os.path.dirname(_bytespath(os.path.realpath(sys.argv[0]))) |
296 hgbin = os.path.join(os.path.dirname(testdir), b'hg') |
297 hgbin = os.path.join(os.path.dirname(testdir), b'hg') |
297 if os.name != 'nt' and not os.access(hgbin, os.X_OK): |
298 if os.name != 'nt' and not os.access(hgbin, os.X_OK): |
1920 os.path.realpath(tmpdir)) |
1921 os.path.realpath(tmpdir)) |
1921 |
1922 |
1922 if self.options.with_hg: |
1923 if self.options.with_hg: |
1923 self._installdir = None |
1924 self._installdir = None |
1924 whg = self.options.with_hg |
1925 whg = self.options.with_hg |
1925 # If --with-hg is not specified, we have bytes already, |
|
1926 # but if it was specified in python3 we get a str, so we |
|
1927 # have to encode it back into a bytes. |
|
1928 if PYTHON3: |
|
1929 if not isinstance(whg, bytes): |
|
1930 whg = _bytespath(whg) |
|
1931 self._bindir = os.path.dirname(os.path.realpath(whg)) |
1926 self._bindir = os.path.dirname(os.path.realpath(whg)) |
1932 assert isinstance(self._bindir, bytes) |
1927 assert isinstance(self._bindir, bytes) |
1933 self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin') |
1928 self._tmpbindir = os.path.join(self._hgtmp, b'install', b'bin') |
1934 os.makedirs(self._tmpbindir) |
1929 os.makedirs(self._tmpbindir) |
1935 |
1930 |