473,625 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there any way to make Python play well with stow?

I'd like to be able to install python with stow, and then to install
various modules which use distutils, also with stow. This currently
pretty much won't work, because Python chases symlinks to set
sys.prefix, which means that the site path gets set to the `true'
location rather than the one with all the links. This means that
Python won't find modules you install with stow, unless you glue the
linky site directory into sys.path. Doing this is OK for
applications, but it means that things like distutils break if there
are modules which depend on other modules which you've installed,
because it won't find those modules.

As an example, assume I have things appear in /local/ and the stow dir
is /local/packages/. So I build python with:

$ ./configure --prefix=/local
$ make
$ make install prefix=/local/packages/python-2.3.4

Then stow it:

$ (cd /local/packages; stow python-2.3.4)

This python's sys.path will have /local/packages in it since
sys.prefix &co have that.

Now install a module, say Numeric:

$ python setup.py install --prefix=/local/packages/numeric
$ (cd /local/packages; stow numeric)

At this point stow will have set things up so that
/local/lib/python-2.3/site-packages/ is a directory (not a link) which
contains links such as Numeric and Numeric.pth pointing to the
appropriate places under /local/packages/numeric/.

Unfortunately python will never even look for this site-packages dir
because of the link-following in the computation of sys.prefix: it
only considers /local/packages/python-2.3.4/lib/python2.3/site-packages/.
So any other module I try and install which needs Numeric will fail.

I can fix this by adding a .pth file to the `real' site packages dir
which points at the linky one, but this is something extra to do every
time I install Python: I'd really like to be able to keep the python
directory tree completely clean.

Is there anything else I can do that's not essentially equivalent to
this (so, for instance, not making the real site-packages dir be a
symlink back to the linky one...)?

I think it would be a good thing if the computation of sys.prefix did
the following: if the python binary is a symbolic link, then before
chasing the symlink, still look for things `this side' of it. If you
find something that looks like a python installation, then construct
sys.prefix &c using those paths. Only if that fails should you chase
the link and look for an installation on the far side of it. This
would allow things like stow to work transparently, I think. Of
course there may be disadvantages of doing this which I haven't
thought of.

Thanks

--tim
Jul 18 '05 #1
1 1993
tf********@tfeb .org (Tim Bradshaw) wrote in message news:<fb******* *************** ****@posting.go ogle.com>...
I'd like to be able to install python with stow, and then to install
various modules which use distutils, also with stow. This currently
pretty much won't work, because Python chases symlinks to set
sys.prefix, which means that the site path gets set to the `true'
location rather than the one with all the links. This means that
Python won't find modules you install with stow, unless you glue the
linky site directory into sys.path. Doing this is OK for
applications, but it means that things like distutils break if there
are modules which depend on other modules which you've installed,
because it won't find those modules. [and so on]


About 5 minutes after posting this I discovered PYTHONHOME, which
completely stops all the intuiting sys.prefix stuff. I feel like a
fool now, and more so since posting via google means I couldn't even
point out my idiocy until today.

--tim
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
18990
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
8
2063
by: John Mowbray | last post by:
I'd like to use Python in my classes, but some students do not have a pc. They do have access to Internet-connected systems, though. Is there a site someplace on the Internet (preferably a web server) where someone can submit a Python program to be run? Telnet may be possible to use, but a browser would be ideal. John
3
7446
by: Bill Dandreta | last post by:
I posted a message ("Help with my 1st Tkinter program") a few days ago complaining that Python did not have any built in basic cross platform sound capability. I was wrong (at least partly). Python comes with some sound playing ability for some platforms. Since no one responded to my post, I assume the capability is not well known so I will post a code snippet from my practice program that demonstrates how I play a sound file with Python...
52
5866
by: Dick Moores | last post by:
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, <http://mathworld.wolfram.com/Base.html>, but I really don't understand it well enough. Could someone show me how to do what I need? Thanks, Dick Moores rdm@rcblue.com
18
2739
by: Joel Hedlund | last post by:
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning from the experts. I feel there's a tradeoff between clear, easily readdable and extensible code on one side, and safe code providing early errors and useful tracebacks on the other. I want both! How do you guys do it? What's the pythonic way? Are...
113
5252
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.