diff --git a/hg b/hg --- a/hg +++ b/hg @@ -27,17 +27,5 @@ libdir = os.path.abspath(libdir) sys.path.insert(0, libdir) -from hgdemandimport import tracing -with tracing.log('hg script'): - # enable importing on demand to reduce startup time - try: - if sys.version_info[0] < 3 or sys.version_info >= (3, 6): - import hgdemandimport; hgdemandimport.enable() - except ImportError: - sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" % - ' '.join(sys.path)) - sys.stderr.write("(check your install and PYTHONPATH)\n") - sys.exit(-1) - - from mercurial import dispatch - dispatch.run() +from mercurial import main +main.main() diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -206,7 +206,7 @@ with open(path, 'wb') as fh: fh.write(content) -scripts = ['hg'] +scripts = [] if os.name == 'nt': # We remove hg.bat if we are able to build hg.exe. scripts.append('contrib/win32/hg.bat') @@ -1504,6 +1504,11 @@ package_data=packagedata, cmdclass=cmdclass, distclass=hgdist, + entry_points={ + 'console_scripts': [ + 'hg = mercurial.main:main', + ], + }, options={ 'py2exe': { 'bundle_files': 3,