setup: prevent setuptools from laying an egg
Previously, test-hghave.t was failing on Windows (and on Linux if
$FORCE_SETUPTOOLS was set) with the following:
--- c:/Users/Matt/Projects/hg/tests/test-hghave.t
+++ c:/Users/Matt/Projects/hg/tests/test-hghave.t.err
@@ -19,7 +19,11 @@
> foo
> EOF
$ run-tests.py $HGTEST_RUN_TESTS_PURE test-hghaveaddon.t
+ warning: Testing with unexpected mercurial lib: c:\Users\Matt\Projects\hg\mercurial
+ (expected ...\hgtests.mu9rou\install\lib\python\mercurial)
.
+ warning: Tested with unexpected mercurial lib: c:\Users\Matt\Projects\hg\mercurial
+ (expected ...\hgtests.mu9rou\install\lib\python\mercurial)
Augie relayed concerns[1] about the first attempt at this, which also excluded
'install_egg_info'. All that needs to be excluded to avoid the egg and make the
test work is to filter out 'bdist_egg'. (Actually, the body of this class could
simply be 'pass', and 'bdist_egg' still isn't run. But that seems to magical.)
Also note that prior to this (and still now), `make clean` doesn't delete the
'mercurial.egg-info' that is generated by `make install`.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097668.html
# no-check-commit
# memory.py - track memory usage
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''helper extension to measure memory usage
Reads current and peak memory usage from ``/proc/self/status`` and
prints it to ``stderr`` on exit.
'''
from __future__ import absolute_import
def memusage(ui):
"""Report memory usage of the current process."""
result = {'peak': 0, 'rss': 0}
with open('/proc/self/status', 'r') as status:
# This will only work on systems with a /proc file system
# (like Linux).
for line in status:
parts = line.split()
key = parts[0][2:-1].lower()
if key in result:
result[key] = int(parts[1])
ui.write_err(", ".join(["%s: %.1f MiB" % (k, v / 1024.0)
for k, v in result.iteritems()]) + "\n")
def extsetup(ui):
ui.atexit(memusage, ui)