# HG changeset patch
# User Sune Foldager <c...@cyanite.org>
# Date 1269270999 -3600
# Node ID d387cfd2cf5b6f45d1d488216b2cbef4acd7b6fd
# Parent  d56ecb62955280c08f3e540db991852f3b97d744
bug fixes and additions for greater flexibility

- The list of extensions is expanded for greater readability and to to make it
  easier to disable individual items.
- The hard-coded list of locations has been factored out so you only need to
  disable extensions in one place.
- A few conditionals have been introduced, based on selected extensions.
- The GTK dll copy has been fixed to allow spaces in the path.

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -56,22 +56,40 @@
 onlymsi = False
 
 URL = {
-  'hg-main'   : 'http://selenic.com/repo/hg/',
-  'tortoisehg': 'http://bitbucket.org/tortoisehg/stable/',
-  'hgfold'    : 'http://bitbucket.org/bradobro/hgfold/',
-  'hgcr-gui'  : 'http://bitbucket.org/glimchb/hgcr-gui/',
-  'perfarce'  : 'http://www.kingswood-consulting.co.uk/hg/perfarce/',
-  'hgeol'     : 'http://bitbucket.org/mg/hg-eol/',
-  'keyring'   : 'http://bitbucket.org/sborho/python-keyring-lib/',
-  'hgkeyring' : 'http://bitbucket.org/Mekk/mercurial_keyring/',
-  'dulwich'   : 'http://bitbucket.org/abderrahim/dulwich/',
-  'wincolor'  : 'http://bitbucket.org/sborho/wincolor/',
+    'hg-main'   : 'http://selenic.com/repo/hg/',
+    'tortoisehg': 'http://bitbucket.org/tortoisehg/stable/',
+    'hgfold'    : 'http://bitbucket.org/bradobro/hgfold/',
+    'hgcr-gui'  : 'http://bitbucket.org/glimchb/hgcr-gui/',
+    'perfarce'  : 'http://www.kingswood-consulting.co.uk/hg/perfarce/',
+    'hgeol'     : 'http://bitbucket.org/mg/hg-eol/',
+    'keyring'   : 'http://bitbucket.org/sborho/python-keyring-lib/',
+    'hgkeyring' : 'http://bitbucket.org/Mekk/mercurial_keyring/',
+    'dulwich'   : 'http://bitbucket.org/abderrahim/dulwich/',
+    'wincolor'  : 'http://bitbucket.org/sborho/wincolor/',
   }
 
-extensions = ['hgfold', 'hgcr-gui', 'perfarce', 'hgeol',
-              'keyring', 'hgkeyring', 'dulwich', 'wincolor']
+extensions = [
+    'hgfold',
+    'hgcr-gui',
+    'perfarce',
+    'hgeol',
+    'keyring',
+    'hgkeyring',
+    'dulwich',
+    'wincolor',
+  ]
+
 thg_source_repos = ['tortoisehg', 'hg-main'] + extensions
 
+ext_loc = {
+    'hgfold': 'hgfold/fold.py',
+    'hgcr-gui': 'hgcr-gui/hgcr-gui.py',
+    'hgeol': 'hgeol/eol.py',
+    'perfarce': 'perfarce/perfarce.py',
+    'hgkeryring': 'hgkeyring/mercurial_keyring.py',
+    'wincolor': 'wincolor/wincolor.py',
+  }
+
 def checkrepo(name, ver=''):
     if os.path.isdir(name):
         return
@@ -210,11 +228,10 @@
         run(r'copy contrib\win32\config.py tortoisehg\util', 'build-thg')
         run(r'copy contrib\win32\setup.cfg .', 'build-thg')
         # Copy bundled Mercurial extensions into build-hg/hgext
-        for ext in ('hgfold/fold.py', 'hgcr-gui/hgcr-gui.py', 'hgeol/eol.py',
-                'perfarce/perfarce.py', 'hgkeyring/mercurial_keyring.py',
-                'wincolor/wincolor.py'):
-            if os.path.exists(ext):
-                shutil.copy(ext, 'build-hg/hgext')
+        for ext in extensions:
+            extloc = ext_loc.get(ext)
+            if ext_loc and os.path.exists(ext_loc):
+                shutil.copy(ext_loc, 'build-hg/hgext')
         # Build docs
         os.environ['hhc_compiler'] = 'hhc.exe'
         run(r'build chm', 'build-thg/doc')
@@ -252,7 +269,7 @@
         for dir in (r'\share\themes\MS-Windows', r'\etc', r'\lib\gtk-2.0'):
             shutil.copytree(gtkpath + dir, r'build-thg\dist\gtk' + dir,
                             ignore=shutil.ignore_patterns('include'))
-        run(r'copy %s\bin\*.dll build-thg\dist\gtk' % gtkpath)
+        run(r'copy "%s\bin\*.dll" build-thg\dist\gtk' % gtkpath)
         run(r'copy misc\gtkrc build-thg\dist\gtk\etc\gtk-2.0')
         for locale in ('cs', 'da', 'de', 'es', 'fr', 'it', 'ja', 'pt',
                        'pt_BR', 'ru', 'uk', 'zh_CN'):
@@ -450,15 +467,21 @@
         sys.exit(1)
 
     # Verify pyreadline
-    try:
-        import pyreadline
-    except ImportError:
-        print 'pyreadline not found:'
-        print 'easy_install --always-unzip pyreadline'
-        sys.exit(1)
+    if 'wincolor' in extensions:
+        try:
+            import pyreadline
+        except ImportError:
+            print 'pyreadline not found:'
+            print 'easy_install --always-unzip pyreadline'
+            sys.exit(1)
 
     oldpath = os.environ.get('PYTHONPATH', '')
-    installenv['PYTHONPATH'] = '../build-hg;../keyring;../dulwich;'+oldpath
+    path = '../build-hg'
+    if 'keyring' in extensions:
+        path += ';../keyring'
+    if 'dulwich' in extensions:
+        path += ';../dulwich'
+    installenv['PYTHONPATH'] = path + ';' + oldpath
 
 def usage(code, msg=''):
     print >> sys.stderr, __doc__

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to