Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
setup.py: fix version handling on Windows exe file creation
The "binary" file versions for exe/dll files on Windows must have the form W.X.Y.Z (with W,X,Y,Z in 0..65535), as can be seen by the warning we currently get from py2exe when doing builds on Windows that are not from a plain tag (i.e. with a '+' in the full version string):
warning: py2exe: Version Info will not be included: could not parse version number '0.9.2+316-bb7de261c6b7+20100201'
Fixed by stripping the version string given to setup() to the part before the '+' on Windows.
Windows exe/dll files can take an arbitrary string in the 'product version' part of the version resource, which can be given to py2exe in the 'product_version' parameter. So we specify the full version string there.
# setup.py# A distutils setup script to install TortoiseHg in Windows and Posix# environments.## On Windows, this script is mostly used to build a stand-alone# TortoiseHg package. See installer\build.txt for details. The other# use is to report the current version of the TortoiseHg source.importtimeimportsysimportosimportsubprocessfromdistutils.coreimportsetupfromdistutils.command.buildimportbuildfromdistutils.spawnimportspawn,find_executablethgcopyright='Copyright (C) 2010 Steve Borho and others'hgcopyright='Copyright (C) 2005-2010 Matt Mackall and others'classbuild_mo(build):description="build translations (.mo files)"defrun(self):ifnotfind_executable('msgfmt'):self.warn("could not find msgfmt executable, no translations ""will be built")returnpodir='i18n/tortoisehg'ifnotos.path.isdir(podir):self.warn("could not find %s/ directory"%podir)returnjoin=os.path.joinforpoinos.listdir(podir):ifnotpo.endswith('.po'):continuepofile=join(podir,po)modir=join('locale',po[:-3],'LC_MESSAGES')mofile=join(modir,'tortoisehg.mo')cmd=['msgfmt','-v','-o',mofile,pofile]ifsys.platform!='sunos5':# msgfmt on Solaris does not know about -ccmd.append('-c')self.mkpath(modir)self.make_file([pofile],mofile,spawn,(cmd,))build.sub_commands.append(('build_mo',None))cmdclass = {
'build_mo': build_mo}
-def setup_windows():
+def setup_windows(version):
# Specific definitios for Windows NT-alike installations
_scripts = []
_data_files = []
_packages=['tortoisehg.hgtk','tortoisehg.hgtk.logview','tortoisehg.util','tortoisehg']extra={}hgextmods=[]# py2exe needs to be installed to worktry:importpy2exe# Help py2exe to find win32com.shelltry:importmodulefinderimportwin32comforpinwin32com.__path__[1:]:# Take the path to win32comextmodulefinder.AddPackagePath("win32com",p)pn="win32com.shell"__import__(pn)m=sys.modules[pn]forpinm.__path__[1:]:modulefinder.AddPackagePath(pn,p)exceptImportError:passexceptImportError:if'--version'notinsys.argv:raiseif'py2exe'insys.argv:importhgexthgextdir=os.path.dirname(hgext.__file__)hgextmods=set(["hgext."+os.path.splitext(f)[0]forfinos.listdir(hgextdir)])_data_files=[(root,[os.path.join(root,file_)forfile_infiles])forroot,dirs,filesinos.walk('icons')]# add library files to support PyGtk-based dialogs/windowsincludes=['dbhash','pango','atk','pangocairo','cairo','gobject']# Manually include other modules py2exe can't find by itself.if'hgext.highlight'inhgextmods:includes+=['pygments.*','pygments.lexers.*','pygments.formatters.*','pygments.filters.*','pygments.styles.*']if'hgext.patchbomb'inhgextmods:includes+=['email.*','email.mime.*']extra['options']={"py2exe":{# This is one way to ensure that hgtk can find its icons when# running in a py2exe environment. It also makes debugging easier."skip_archive":0,# Don't pull in all this MFC stuff used by the makepy UI."excludes":"pywin,pywin.dialogs,pywin.dialogs.list","includes":includes,"optimize":1}} extra['console'] = [
{'script':'contrib/hg',
'icon_resources':[(0,'icons/hg.ico')],
- 'copyright':hgcopyright},
+ 'copyright':hgcopyright,+ 'product_version':version},
{'script':'hgtk',
'icon_resources':[(0,'icons/thg_logo.ico')],
- 'copyright':thgcopyright},
+ 'copyright':thgcopyright,+ 'product_version':version},
{'script':'contrib/docdiff.py',
'icon_resources':[(0,'icons/TortoiseMerge.ico')],
- 'copyright':thgcopyright}
+ 'copyright':thgcopyright,+ 'product_version':version}
]
extra['windows'] = [
{'script':'thgtaskbar.py',
'icon_resources':[(0,'icons/thg_logo.ico')],
- 'copyright':thgcopyright}
+ 'copyright':thgcopyright,+ 'product_version':version}
]
return _scripts, _packages, _data_files, extra
defsetup_posix():# Specific definitios for Posix installations_extra={}_scripts=['hgtk']_packages=['tortoisehg','tortoisehg.hgtk','tortoisehg.hgtk.logview','tortoisehg.util']_data_files=[(os.path.join('share/pixmaps/tortoisehg',root),[os.path.join(root,file_)forfile_infiles])forroot,dirs,filesinos.walk('icons')]_data_files+=[(os.path.join('share',root),[os.path.join(root,file_)forfile_infiles])forroot,dirs,filesinos.walk('locale')]_data_files+=[('lib/nautilus/extensions-2.0/python',['contrib/nautilus-thg.py'])]# Create a config.py. Distributions will need to supply their owncfgfile=os.path.join('tortoisehg','util','config.py')ifnotos.path.exists(cfgfile)andnotos.path.exists('.hg/requires'):f=open(cfgfile,"w")f.write('bin_path = "/usr/bin"\n')f.write('license_path = "/usr/share/doc/tortoisehg/Copying.txt.gz"\n')f.write('locale_path = "/usr/share/locale"\n')f.write('icon_path = "/usr/share/pixmaps/tortoisehg/icons"\n')f.write('nofork = True\n')f.close() return _scripts, _packages, _data_files, _extra
--if os.name == "nt":- (scripts, packages, data_files, extra) = setup_windows()- desc='Windows shell extension for Mercurial VCS'-else:- (scripts, packages, data_files, extra) = setup_posix()- desc='TortoiseHg dialogs for Mercurial VCS'-def runcmd(cmd, env):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
out,err=p.communicate()# If root is executing setup.py, but the repository is owned by# another user (as in "sudo python setup.py install") we will get# trust warnings since the .hg/hgrc file is untrusted. That is# fine, we don't want to load it anyway.err=[eforeinerr.splitlines()ifnote.startswith('Not trusting file')]iferr:return''returnoutversion=''ifos.path.isdir('.hg'):fromtortoisehg.utilimportversionas_versionversion=_version.liveversion()ifversion.endswith('+'):version+=time.strftime('%Y%m%d')elifos.path.exists('.hg_archival.txt'):kw=dict([t.strip()fortinl.split(':',1)]forlinopen('.hg_archival.txt'))if'tag'inkw:version=kw['tag']elif'latesttag'inkw:version='%(latesttag)s+%(latesttagdistance)s-%(node).12s'%kwelse:version=kw.get('node','')[:12]ifversion:f=open("tortoisehg/util/__version__.py","w")f.write('# this file is autogenerated by setup.py\n')f.write('version = "%s"\n'%version)f.close()try:importtortoisehg.util.__version__version=tortoisehg.util.__version__.versionexcept ImportError:
version = 'unknown'
+if os.name == "nt":+ (scripts, packages, data_files, extra) = setup_windows(version)+ desc='Windows shell extension for Mercurial VCS'+ # Windows binary file versions for exe/dll files must have the+ # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535+ setupversion=version.split('+', 1)[0]+else:+ (scripts, packages, data_files, extra) = setup_posix()+ desc='TortoiseHg dialogs for Mercurial VCS'+ setupversion=version+setup(name="tortoisehg",
- version=version,
+ version=setupversion,
author='Steve Borho',
author_email='steve@borho.org',
url='http://tortoisehg.org',
description=desc,license='GNU GPL2',scripts=scripts,packages=packages,data_files=data_files,cmdclass=cmdclass,**extra)
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.