Merge lp:~maddevelopers/mg5amcnlo/tab_complete_for_mac into lp:~madteam/mg5amcnlo/trunk

Proposed by Johan Alwall
Status: Merged
Merged at revision: 64
Proposed branch: lp:~maddevelopers/mg5amcnlo/tab_complete_for_mac
Merge into: lp:~madteam/mg5amcnlo/trunk
Diff against target: 74 lines (+6/-24)
2 files modified
.project (+0/-17)
bin/mg5 (+6/-7)
To merge this branch: bzr merge lp:~maddevelopers/mg5amcnlo/tab_complete_for_mac
Reviewer Review Type Date Requested Status
Olivier Mattelaer Approve
Review via email: mp+44403@code.launchpad.net

Commit message

Olivier, can you help check with different computers that the tab completion works everywhere?

Description of the change

Changed bind command for readline in bin/mg5 to allow tab complete for Mac OS X

To post a comment you must log in.
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

In fact tab completion was working already before...
With some bug for finding path. This bug is solve in restrict_model (I made a local merge and it's still compatible with your change here)
So up to I know this works...

Do you have more information on the python instalation that fails to have autocompletion?
(pre-build python 2.6 comming with 10.6 maybe?)

review: Needs Information
Revision history for this message
Johan Alwall (johan-alwall) wrote :

The previous tab completion didn't work with the Python coming with
10.6 (on two different computers), while this one works out of the
box. If only it doesn't ruin tab completion on Linux machines (it
works on my laptop) I would suggest to do the merge, in order to avoid
problems for the many Mac users.

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Ok that's the reason I'm on standard python. (The python coming with 10.6 is not exactly the python2.6 distributed on the web).

In fact I'm on a mac too, maybe we should also ask Tim for this, in order to be sure.

Cheers,

Olivier

review: Approve
Revision history for this message
Johan Alwall (johan-alwall) wrote :

Unfortunately we can't expect users to upgrade their Python if they
already have 2.6.x just for tab completion.

Can you try on some of the fynu machines with clean Python installs
(including readline)? It works fine on my Ubuntu, but would be good to
cross check with some other machines.

Thanks!

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

> Unfortunately we can't expect users to upgrade their Python if they
> already have 2.6.x just for tab completion.

Off course not

> Can you try on some of the fynu machines with clean Python installs
> (including readline)? It works fine on my Ubuntu, but would be good to
> cross check with some other machines.

Sure I will!!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.project'
2--- .project 2010-08-16 15:41:39 +0000
3+++ .project 1970-01-01 00:00:00 +0000
4@@ -1,17 +0,0 @@
5-<?xml version="1.0" encoding="UTF-8"?>
6-<projectDescription>
7- <name>MG-new_color_stuff</name>
8- <comment></comment>
9- <projects>
10- </projects>
11- <buildSpec>
12- <buildCommand>
13- <name>org.python.pydev.PyDevBuilder</name>
14- <arguments>
15- </arguments>
16- </buildCommand>
17- </buildSpec>
18- <natures>
19- <nature>org.python.pydev.pythonNature</nature>
20- </natures>
21-</projectDescription>
22
23=== modified file 'bin/mg5'
24--- bin/mg5 2010-12-21 16:13:52 +0000
25+++ bin/mg5 2010-12-21 23:17:52 +0000
26@@ -19,21 +19,21 @@
27 and call immediately the command line interface scripts"""
28
29 import sys
30-
31 if not sys.version_info[0] == 2 or sys.version_info[1] < 6:
32 sys.exit('MadGraph 5 works only with python 2.6 or later (but not python 3.X).\n\
33 Please upgrate your version of python.')
34
35+import os
36+
37 # tab completion and history
38 try:
39+ import rlcompleter
40 import readline
41 except ImportError:
42 print "For tab completion and history, install module readline."
43 else:
44- import rlcompleter
45- readline.parse_and_bind("tab: complete")
46+ readline.parse_and_bind("bind ^I rl_complete")
47 try:
48- import os
49 history_file = os.path.join(os.environ['HOME'], '.pythonhistory')
50 readline.read_history_file(history_file)
51 except:
52@@ -44,12 +44,11 @@
53 import logging.config
54
55 import subprocess
56-import os.path as path
57
58 # Get the parent directory (mg root) of the script real path (bin)
59 # and add it to the current PYTHONPATH
60
61-root_path = path.split(path.dirname(path.realpath( __file__ )))[0]
62+root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0]
63 sys.path.append(root_path)
64
65
66@@ -81,7 +80,7 @@
67 # Set logging level according to the logging level given by options
68 #logging.basicConfig(level=vars(logging)[options.logging])
69 try:
70- logging.config.fileConfig(path.join(root_path, 'madgraph', 'interface', '.mg5_logging.conf'))
71+ logging.config.fileConfig(os.path.join(root_path, 'madgraph', 'interface', '.mg5_logging.conf'))
72 logging.root.setLevel(eval('logging.' + options.logging))
73 logging.getLogger('madgraph').setLevel(eval('logging.' + options.logging))
74 except:

Subscribers

People subscribed via source and target branches