Show More
@@ -594,6 +594,11 b' def getparser():' | |||||
594 | action="store_true", |
|
594 | action="store_true", | |
595 | help="install and use rhg Rust implementation in place of hg", |
|
595 | help="install and use rhg Rust implementation in place of hg", | |
596 | ) |
|
596 | ) | |
|
597 | hgconf.add_argument( | |||
|
598 | "--pyoxidized", | |||
|
599 | action="store_true", | |||
|
600 | help="build the hg binary using pyoxidizer", | |||
|
601 | ) | |||
597 | hgconf.add_argument("--compiler", help="compiler to build with") |
|
602 | hgconf.add_argument("--compiler", help="compiler to build with") | |
598 | hgconf.add_argument( |
|
603 | hgconf.add_argument( | |
599 | '--extra-config-opt', |
|
604 | '--extra-config-opt', | |
@@ -731,6 +736,8 b' def parseargs(args, parser):' | |||||
731 | parser.error( |
|
736 | parser.error( | |
732 | '--local cannot be used with --with-hg or --with-rhg or --with-chg' |
|
737 | '--local cannot be used with --with-hg or --with-rhg or --with-chg' | |
733 | ) |
|
738 | ) | |
|
739 | if options.pyoxidized: | |||
|
740 | parser.error('--pyoxidized does not work with --local (yet)') | |||
734 | testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) |
|
741 | testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) | |
735 | reporootdir = os.path.dirname(testdir) |
|
742 | reporootdir = os.path.dirname(testdir) | |
736 | pathandattrs = [(b'hg', 'with_hg')] |
|
743 | pathandattrs = [(b'hg', 'with_hg')] | |
@@ -764,6 +771,8 b' def parseargs(args, parser):' | |||||
764 | parser.error('chg does not work on %s' % os.name) |
|
771 | parser.error('chg does not work on %s' % os.name) | |
765 | if (options.rhg or options.with_rhg) and WINDOWS: |
|
772 | if (options.rhg or options.with_rhg) and WINDOWS: | |
766 | parser.error('rhg does not work on %s' % os.name) |
|
773 | parser.error('rhg does not work on %s' % os.name) | |
|
774 | if options.pyoxidized and not WINDOWS: | |||
|
775 | parser.error('--pyoxidized is currently Windows only') | |||
767 | if options.with_chg: |
|
776 | if options.with_chg: | |
768 | options.chg = False # no installation to temporary location |
|
777 | options.chg = False # no installation to temporary location | |
769 | options.with_chg = canonpath(_sys2bytes(options.with_chg)) |
|
778 | options.with_chg = canonpath(_sys2bytes(options.with_chg)) | |
@@ -3223,6 +3232,16 b' class TestRunner(object):' | |||||
3223 | rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) |
|
3232 | rhgbindir = os.path.dirname(os.path.realpath(self.options.with_rhg)) | |
3224 | self._hgcommand = os.path.basename(self.options.with_rhg) |
|
3233 | self._hgcommand = os.path.basename(self.options.with_rhg) | |
3225 |
|
3234 | |||
|
3235 | if self.options.pyoxidized: | |||
|
3236 | testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) | |||
|
3237 | reporootdir = os.path.dirname(testdir) | |||
|
3238 | # XXX we should ideally install stuff instead of using the local build | |||
|
3239 | bin_path = ( | |||
|
3240 | b'build/pyoxidizer/x86_64-pc-windows-msvc/release/app/hg.exe' | |||
|
3241 | ) | |||
|
3242 | full_path = os.path.join(reporootdir, bin_path) | |||
|
3243 | self._hgcommand = full_path | |||
|
3244 | ||||
3226 | osenvironb[b"BINDIR"] = self._bindir |
|
3245 | osenvironb[b"BINDIR"] = self._bindir | |
3227 | osenvironb[b"PYTHON"] = PYTHON |
|
3246 | osenvironb[b"PYTHON"] = PYTHON | |
3228 |
|
3247 | |||
@@ -3463,6 +3482,8 b' class TestRunner(object):' | |||||
3463 | if self.options.rhg: |
|
3482 | if self.options.rhg: | |
3464 | assert self._installdir |
|
3483 | assert self._installdir | |
3465 | self._installrhg() |
|
3484 | self._installrhg() | |
|
3485 | elif self.options.pyoxidized: | |||
|
3486 | self._build_pyoxidized() | |||
3466 | self._use_correct_mercurial() |
|
3487 | self._use_correct_mercurial() | |
3467 |
|
3488 | |||
3468 | log( |
|
3489 | log( | |
@@ -3875,6 +3896,37 b' class TestRunner(object):' | |||||
3875 | sys.stdout.write(out) |
|
3896 | sys.stdout.write(out) | |
3876 | sys.exit(1) |
|
3897 | sys.exit(1) | |
3877 |
|
3898 | |||
|
3899 | def _build_pyoxidized(self): | |||
|
3900 | """build a pyoxidized version of mercurial into the test environment | |||
|
3901 | ||||
|
3902 | Ideally this function would be `install_pyoxidier` and would both build | |||
|
3903 | and install pyoxidier. However we are starting small to get pyoxidizer | |||
|
3904 | build binary to testing quickly. | |||
|
3905 | """ | |||
|
3906 | vlog('# build a pyoxidized version of Mercurial') | |||
|
3907 | assert os.path.dirname(self._bindir) == self._installdir | |||
|
3908 | assert self._hgroot, 'must be called after _installhg()' | |||
|
3909 | cmd = b'"%(make)s" pyoxidizer' % { | |||
|
3910 | b'make': b'make', | |||
|
3911 | } | |||
|
3912 | cwd = self._hgroot | |||
|
3913 | vlog("# Running", cmd) | |||
|
3914 | proc = subprocess.Popen( | |||
|
3915 | _bytes2sys(cmd), | |||
|
3916 | shell=True, | |||
|
3917 | cwd=_bytes2sys(cwd), | |||
|
3918 | stdin=subprocess.PIPE, | |||
|
3919 | stdout=subprocess.PIPE, | |||
|
3920 | stderr=subprocess.STDOUT, | |||
|
3921 | ) | |||
|
3922 | out, _err = proc.communicate() | |||
|
3923 | if proc.returncode != 0: | |||
|
3924 | if PYTHON3: | |||
|
3925 | sys.stdout.buffer.write(out) | |||
|
3926 | else: | |||
|
3927 | sys.stdout.write(out) | |||
|
3928 | sys.exit(1) | |||
|
3929 | ||||
3878 | def _outputcoverage(self): |
|
3930 | def _outputcoverage(self): | |
3879 | """Produce code coverage output.""" |
|
3931 | """Produce code coverage output.""" | |
3880 | import coverage |
|
3932 | import coverage |
General Comments 0
You need to be logged in to leave comments.
Login now