Staging
v0.5.1
v0.5.1
https://foss.heptapod.net/mercurial/hgview
Revision 10aa08a03c7c901ab7b7c9a789aec99cb448ae92 authored by Pierre-Yves David on 19 November 2012, 14:10:17 UTC, committed by Pierre-Yves David on 19 November 2012, 14:10:17 UTC
Not including mercurial extension cause several issues. After long battle with py2exe we fallback to this ugly fix. I how we can get with something better later but we do not want to delay 1.7 release any further.
1 parent e33f4d9
Tip revision: 10aa08a03c7c901ab7b7c9a789aec99cb448ae92 authored by Pierre-Yves David on 19 November 2012, 14:10:17 UTC
[setup/py2exe] trick py2exe into including mercurial extension
[setup/py2exe] trick py2exe into including mercurial extension
Tip revision: 10aa08a
hgview_py2exe.py
#!/usr/bin/env python
# hgview: visual mercurial graphlog browser in PyQt4
#
# Copyright 2008-2010 Logilab
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
"""
Hg repository log browser.
This is a standalone version of the application built using py2exe.
See README file included.
"""
import sys, os
import os.path as pos
# Standalone version of hgview built with py2exe use they how version
# of mercurial. Using configuration from the global Mercurial.ini will be
# ill-advised as the installed version of Mercurial itself may be
# different than the one we ship.
#
# this will lay aside Mercurial.ini
path = pos.join(os.path.expanduser('~'), 'hgview.ini')
os.environ['HGRCPATH'] = path
# We could not import the module that defines the original class because
# of sys._Messagebox missing error (see py2exe.boot_common.py). So, we
# intropect to get access to the original class.
LOGPATH = pos.join(pos.expanduser('~'), 'hgview.log')
class Stderr(sys.stderr.__class__):
def write(self, *args, **kwargs):
kwargs['fname'] = LOGPATH
super(Stderr, self).write(*args[:2], **kwargs)
sys.stderr = Stderr() # open(pos.join(pos.expanduser('~'), 'hgview.log'), 'a')
# clean log
if pos.exists(LOGPATH):
try:
os.remove(LOGPATH)
except EnvironmentError: # could not be remove if 2 hgview are opened
pass
from hgviewlib.application import main
main()
Computing file changes ...