Mailing List Archive

[PATCH] Make non-native python path handling a
ChangeSet 1.1159.256.97, 2005/04/15 23:00:50+01:00, katzj@redhat.com

[PATCH] Make non-native python path handling a
> > Although I don't really agree with the installing of the
> > python bits to the non-native paths, I can see where it's
> > useful as long as the module ABI doesn't change if you're
> > trying to distribute binary tarballs. But with the current
> > handling it adds module lookup costs for the native path case
> > (which would be the norm) as well as prevents using
> > PYTHONPATH to look to a different location for the modules.
> >
> > The attached patch changes things so that at first, the xen
> > module is attempted to be imported from the stock paths. If
> > we get an ImportError exception, then it adds /usr/lib/python
> > to the end of the python path and imports again.
>
> Do you prefer this to just unconditionally addding /usr/lib/python to
> the end of the path rather than the front?

Slightly, but just because having /usr/lib/python in my sys.path is
ugly :-) I can look over it, though... patch doing that attached

Signed-off-by: Jeremy Katz <katzj@redhat.com>

===== tools/misc/netfix 1.13 vs edited =====



netfix | 4 ++--
xend | 4 ++--
xensv | 4 ++--
xm | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)


diff -Nru a/tools/misc/netfix b/tools/misc/netfix
--- a/tools/misc/netfix 2005-04-15 19:02:35 -04:00
+++ b/tools/misc/netfix 2005-04-15 19:02:35 -04:00
@@ -9,8 +9,8 @@

from getopt import getopt

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.util.Brctl import *

short_options = 'hvqni:b:c'
diff -Nru a/tools/misc/xend b/tools/misc/xend
--- a/tools/misc/xend 2005-04-15 19:02:35 -04:00
+++ b/tools/misc/xend 2005-04-15 19:02:35 -04:00
@@ -22,8 +22,8 @@
import os
import sys

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xend.server import SrvDaemon

class CheckError(ValueError):
diff -Nru a/tools/misc/xensv b/tools/misc/xensv
--- a/tools/misc/xensv 2005-04-15 19:02:35 -04:00
+++ b/tools/misc/xensv 2005-04-15 19:02:35 -04:00
@@ -22,8 +22,8 @@
import sys
import re

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xend.server.params import XEND_PID_FILE

class CheckError(ValueError):
diff -Nru a/tools/misc/xm b/tools/misc/xm
--- a/tools/misc/xm 2005-04-15 19:02:35 -04:00
+++ b/tools/misc/xm 2005-04-15 19:02:35 -04:00
@@ -2,8 +2,8 @@
# -*- mode: python; -*-
import sys

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xm import main

main.main(sys.argv)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
[PATCH] Make non-native python path handling a [ In reply to ]
ChangeSet 1.1831, 2005/04/15 23:00:50+01:00, katzj@redhat.com

[PATCH] Make non-native python path handling a
> > Although I don't really agree with the installing of the
> > python bits to the non-native paths, I can see where it's
> > useful as long as the module ABI doesn't change if you're
> > trying to distribute binary tarballs. But with the current
> > handling it adds module lookup costs for the native path case
> > (which would be the norm) as well as prevents using
> > PYTHONPATH to look to a different location for the modules.
> >
> > The attached patch changes things so that at first, the xen
> > module is attempted to be imported from the stock paths. If
> > we get an ImportError exception, then it adds /usr/lib/python
> > to the end of the python path and imports again.
>
> Do you prefer this to just unconditionally addding /usr/lib/python to
> the end of the path rather than the front?

Slightly, but just because having /usr/lib/python in my sys.path is
ugly :-) I can look over it, though... patch doing that attached

Signed-off-by: Jeremy Katz <katzj@redhat.com>

===== tools/misc/netfix 1.13 vs edited =====



netfix | 4 ++--
xend | 4 ++--
xensv | 4 ++--
xm | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)


diff -Nru a/tools/misc/netfix b/tools/misc/netfix
--- a/tools/misc/netfix 2005-04-15 19:05:02 -04:00
+++ b/tools/misc/netfix 2005-04-15 19:05:02 -04:00
@@ -9,8 +9,8 @@

from getopt import getopt

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.util.Brctl import *

short_options = 'hvqni:b:c'
diff -Nru a/tools/misc/xend b/tools/misc/xend
--- a/tools/misc/xend 2005-04-15 19:05:02 -04:00
+++ b/tools/misc/xend 2005-04-15 19:05:02 -04:00
@@ -22,8 +22,8 @@
import os
import sys

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xend.server import SrvDaemon

class CheckError(ValueError):
diff -Nru a/tools/misc/xensv b/tools/misc/xensv
--- a/tools/misc/xensv 2005-04-15 19:05:02 -04:00
+++ b/tools/misc/xensv 2005-04-15 19:05:02 -04:00
@@ -22,8 +22,8 @@
import sys
import re

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xend.server.params import XEND_PID_FILE

class CheckError(ValueError):
diff -Nru a/tools/misc/xm b/tools/misc/xm
--- a/tools/misc/xm 2005-04-15 19:05:02 -04:00
+++ b/tools/misc/xm 2005-04-15 19:05:02 -04:00
@@ -2,8 +2,8 @@
# -*- mode: python; -*-
import sys

-# Default install path for Xen binary packages.
-sys.path = [ '/usr/lib/python' ] + sys.path
+# add fallback path for non-native python path installs if needed
+sys.path.append('/usr/lib/python')
from xen.xm import main

main.main(sys.argv)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog