Re: confused with so many python package locations for imports
Ben Finney wrote: Chris Rebert c...@rebertia.com writes: Erm, .pyo-s aren't platform-specific. […] It's not like .pyo-s are compiled C extension modules. Thank you for the correction. Please mentally substitute into my argument the files that *are* compiled C extension modules; it remains otherwise unchanged. But the compiled C extension modules are called .pyd files and they are built separately from the execution time and thus do not suffer the faults of which you complain. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
Scott David Daniels scott.dani...@acm.org writes: Ben Finney wrote: Thank you for the correction. Please mentally substitute into my argument the files that *are* compiled C extension modules; it remains otherwise unchanged. But the compiled C extension modules are called .pyd files and they are built separately from the execution time and thus do not suffer the faults of which you complain. I didn't discuss build versus execution time at all. My point was, for those who are still distracted: Whatever they're named, whenever they're built, the architecture-dependent executable module files are by default located and searched for in the same place as architecture-independent executable module files. That is a mismatch between Python and the FHS. One which is being actively addressed, if I understand some enthusiastic reports from PyCon 2009 correctly; but nevertheless, one which impacts the ideal the original poster is hoping for. -- \“I saw a sign: ‘Rest Area 25 Miles’. That's pretty big. Some | `\ people must be really tired.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
On Sat, 2009-04-25 at 14:16 +0900, David Cournapeau wrote: Some of those locations are OS specific - pyshare is specific to debian I think, for example. My Basic question is that, what package directory is Standard as far as all gnu/linux distros are concerned? In other words I would like to know if there is some package directory which is searched by default for installed packages? I believed it was /usr/local/lib/python2.6/site-packages. In the case of python 2.5 it must be the same, but correct me if I am wrong. I want my distutils setup.py to setup the package so that an import statement can import the package no matter what distro of gnu/linux we are running. happy hacking. Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
Krishnakant hackin...@gmail.com writes: My Basic question is that, what package directory is Standard as far as all gnu/linux distros are concerned? Python has a habit of generating, and expecting to find, platform-specific files (‘foo.pyo’ extension modules), compiled bytecode files (‘foo.pyc’), and module source files (‘foo.py’) necessarily in the same directory for purpose of locating them at import time. This goes very contrary to most standards of Unix and GNU filesystem standards, including the FHS, which prefers to keep firm distinction between files that are source, platform-independent binary, and platform-dependent binary, and have them all in separate defined locations by default. So, it's not clear at all where Python's all-in-one conglomeration of different filetypes in a single directory tree should be located on Unix or GNU. Hence the differences over time and across different distributions, as GNU distributors try different workarounds for Python's current foibles in this area. In other words I would like to know if there is some package directory which is searched by default for installed packages? Yes, there is. That location is as defined by the Python executable on your system. I want my distutils setup.py to setup the package so that an import statement can import the package no matter what distro of gnu/linux we are running. You are currently out of luck. The distutils design is currently undergoing review and design evolution in order to make this easier, and AFAICT there was a lot of enthusiasm and good work done at this year's PyCon, but IMHO we're a long way from sorting out the mismatch between Python and the FHS. -- \ “I am amazed, O Wall, that you have not collapsed and fallen, | `\since you must bear the tedious stupidities of so many | _o__) scrawlers.” —anonymous graffiti, Pompeii, 79 CE | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
On Sat, 2009-04-25 at 18:31 +1000, Ben Finney wrote: Python has a habit of generating, and expecting to find, platform-specific files (‘foo.pyo’ extension modules), compiled bytecode files (‘foo.pyc’), and module source files (‘foo.py’) necessarily in the same directory for purpose of locating them at import time. Thanks a lot for this information. So now if I say for example choose ubuntu and debian for my testing purpose, should I put all the packages I make into /usr/local/lib/python2.6/site-packages? Will this be a safe choice for at least debian and Ubuntu? I will later on think of fedora etc. happy hacking. Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
Krishnakant hackin...@gmail.com writes: So now if I say for example choose ubuntu and debian for my testing purpose, should I put all the packages I make into /usr/local/lib/python2.6/site-packages? Will this be a safe choice for at least debian and Ubuntu? No, for Debian and/or Ubuntu, you should avoid moving files around manually and instead use the developer tools available. You should use the latest ‘debhelper’ for many of the general and specific low-level tasks needed while building a package, and you should use the latest ‘python-support’ (which works in concert with ‘debhelper’) for a conduit between your ‘setup.py’ and the Debian packaging system. For more information, read the Debian Developer's Reference (for general instructions on making packages for Debian), and the documentation for the ‘python-support’ package. -- \ “If [a technology company] has confidence in their future | `\ ability to innovate, the importance they place on protecting | _o__) their past innovations really should decline.” —Gary Barnett | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
On Sat, Apr 25, 2009 at 1:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Krishnakant hackin...@gmail.com writes: My Basic question is that, what package directory is Standard as far as all gnu/linux distros are concerned? Python has a habit of generating, and expecting to find, platform-specific files (‘foo.pyo’ extension modules) Erm, .pyo-s aren't platform-specific. According to http://docs.python.org/dev/tutorial/modules.html#compiled-python-files : When the Python interpreter is invoked with the -O flag, optimized code is generated and stored in .pyo files. The optimizer currently doesn’t help much; it only removes assert statements. Passing two -O flags to the Python interpreter (-OO) will cause the bytecode compiler to perform optimizations that could in some rare cases result in malfunctioning programs. Currently only __doc__ strings are removed from the bytecode, resulting in more compact .pyo files. A program doesn’t run any faster when it is read from a .pyc or .pyo file than when it is read from a .py file; the only thing that’s faster about .pyc or .pyo files is the speed with which they are loaded. It's not like .pyo-s are compiled C extension modules. Cheers, Chris -- I have a blog: http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
Chris Rebert c...@rebertia.com writes: Erm, .pyo-s aren't platform-specific. […] It's not like .pyo-s are compiled C extension modules. Thank you for the correction. Please mentally substitute into my argument the files that *are* compiled C extension modules; it remains otherwise unchanged. -- \“If you ever drop your keys into a river of molten lava, let | `\ 'em go, because, man, they're gone.” —Jack Handey | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
confused with so many python package locations for imports
hello all, I was doing my first complete python packaging for my software and I am totally confused. I see, /usr/local/lib/python-2.6/site-packages and also dist-packages. Then I also see a directory called pyshare, then again site-packages in usr/lib/python (I am not even remembering correct paths for many such locations ). Now my question is, which the perfect place? I would like to know if I write a distutils based setup.py for my application, then which is the place which I should choose? happy hacking. Krishnakant. -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
Krishnakant hackin...@gmail.com writes: Now my question is, which the perfect place? Your question is unrelated to the message to which you're replying. To start a new discussion, do not reply to an existing message (causing your message to be incorrectly associated with that existing message). Instead, compose a new message addressed to this forum. -- \ “I got up the other day, and everything in my apartment has | `\ been stolen and replaced with an exact replica.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: confused with so many python package locations for imports
On Sat, Apr 25, 2009 at 2:36 AM, Krishnakant hackin...@gmail.com wrote: hello all, I was doing my first complete python packaging for my software and I am totally confused. I see, /usr/local/lib/python-2.6/site-packages and also dist-packages. Then I also see a directory called pyshare, then again site-packages in usr/lib/python (I am not even remembering correct paths for many such locations ). Some of those locations are OS specific - pyshare is specific to debian I think, for example. Now my question is, which the perfect place? I would like to know if I write a distutils based setup.py for my application, then which is the place which I should choose? I am not sure I understand: your package setup and installation location are totally independent. Once you finish your package, you can install it wherever you want, using the --prefix option of the distutils install command. You should avoid using /usr as an installation prefix, because it is generally assumed to be owned by the system. /usr/local is not, though. David -- http://mail.python.org/mailman/listinfo/python-list