dmwm / cmssh

Interactive shell for CMS experiment
http://cms.cern.ch/
7 stars 2 forks source link

Detect libreadline on Linux using ldconfig -p #44

Closed neggert closed 11 years ago

neggert commented 11 years ago

This addresses #43 by implementing the suggestion to use ldconfig -p to list all libraries. I've tested it on ubuntu 12.04. It should also work on other linux systems.

vkuznet commented 11 years ago

Nic, I merged the change. Thanks, Valentin.

On Nov 28, 2012, at ,Nov 28, 1:02 PM, Nic Eggert wrote:

This addresses #43 by implementing the suggestion to use ldconfig -p to list all libraries. I've tested it on ubuntu 12.04. It should also work on other linux systems.

You can merge this Pull Request by running:

git pull https://github.com/neggert/cmssh detect_libreadline Or view, comment on, or merge it at:

https://github.com/dmwm/cmssh/pull/44

Commit Summary

Detect libreadline on Linux using ldconfig -p instead of assuming a l… File Changes

M cmssh_install.py (6) Patch Links

https://github.com/dmwm/cmssh/pull/44.patch https://github.com/dmwm/cmssh/pull/44.diff — Reply to this email directly or view it on GitHub.

vkuznet commented 11 years ago

I was need to adjust the code since subprocess.check_output exists only in python 2.7, but does not in python 2.6. Here is a patch:

-        if not re.search("libreadline\.so\.5", subprocess.check_output(["/sbin/ldconfig", "-p"])):
+        if  hasattr(subprocess, "check_output"):
+            cond = re.search("libreadline\.so\.5", subprocess.check_output(["/sbin/ldconfig", "-p"]))
+        else:
+            cmd  = "/sbin/ldconfig -p"
+            res  = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+            libs = [l for l in res.stdout.readlines() if l.find('libreadline.so.5') != -1]
+            cond = len(libs)
+        if  not cond:
neggert commented 11 years ago

Whoops, sorry. I didn't realize you still supported 2.6. Your fix should work.

vkuznet commented 11 years ago

Not me :), CMS soft is based on python 2.6

On Nov 29, 2012, at ,Nov 29, 3:39 PM, Nic Eggert wrote:

Whoops, sorry. I didn't realize you still supported 2.6. Your fix should work.

— Reply to this email directly or view it on GitHub.