[04:17:12] ** apoirier has joined us [04:32:24] ** mike8 has joined us [05:38:49] [connected at Fri Apr 20 05:38:49 2007] [05:38:49] <> *** Looking up your hostname... [05:38:50] <> *** Checking ident [05:38:50] <> *** No identd (auth) response [05:38:50] <> *** Found your hostname [05:38:50] <> *** Your host is sterling.freenode.net[freebsd.widexs.nl/6667], running version hyperion-1.0.2b [05:38:51] [I have joined #peak] [06:59:19] ** mike8 has left IRC (sterling.freenode.net irc.freenode.net) [06:59:19] ** zooko has left IRC (sterling.freenode.net irc.freenode.net) [06:59:51] ** mike8 has joined us [06:59:51] ** zooko has joined us [08:14:38] ** apoirier has left IRC ("KVIrc 3.2.0 'Realia'") [11:37:02] ** pje has joined us [11:50:07] pje is now known as pje_mtg [12:15:50] ** coderanger_ has joined us [12:34:07] pje_mtg is now known as pje [13:27:33] ** coderanger_ has left IRC ("next class") [14:03:35] ** zooko has left IRC (Read error: 104 (Connection reset by peer)) [14:04:28] ** zooko has joined us [14:37:55] Wow. setuptools overwrote my source code with a "script" bootstrapper script. [14:38:05] I'm looking at the docs but I don't see how to control this behavior. [14:49:15] Okay, by experimentation, the secret is not to put your source code in a dir named "bin". [14:49:27] It might be cool if setuptools noticed that was what was happening and errored out... [15:11:39] ** zooko has left us [15:37:56] ** zooko has joined us [16:05:36] Hm. [16:32:45] Does anyone have a recommended recipe for using setuptools on top of GNU stow? [16:33:56] Also, my attempt to use setuptools to build an executable script on Windows failed badly. [16:34:17] It put a file into the "Scripts" directory, but that file cannot execute in any way other than "python $fullpathtofile", as far as I can tell. [16:35:02] This is worse that before I added setuptools. At that time I had "#!/usr/bin/env python", and this worked thanks to cygwin. [16:35:25] I don't mean to sound negative -- I really like the idea of setuptools and I'm glad to see it gaining wider usage -- [16:35:37] but so far it doesn't look like it can do the things I need for my project. [16:43:32] zooko: What are you using to generate the ee [16:43:35] er, exe [16:44:29] ./setup.py install [16:44:36] But it isn't an .exe. [16:44:59] It just copies my source files, after inserting an extra blank line in between each line and after changing the shebang line from something that works to something that doesn't. :-) [16:45:36] I'm sorry, but I've gotta go for a little while. I'll be back in about half an hour. [16:45:42] But you were using the extension point system? [17:36:38] * zooko looks in the docs the extension point system... [17:38:15] coderanger: See, I had a setup.py that I already worked with distutils and I just changed "from distutils.core" to "from setuptools" at the top and tried it. [17:38:34] zooko: Yeah, thats a bad idea ..... [17:38:36] Thanks for the hint about the extension points. [17:38:49] If you need to install scripts, use the extension point for them [17:39:10] Do you think that in the future setuptools will grow a py2exe integration? Or a py2exe replacement? [17:39:18] Heck no [17:39:39] Why would it need to when py2exe already exists? [17:40:37] py2exe is already a distutils extension, it should hypothetically work with setuptools as well [17:40:48] can't say I've ever tried it though [17:44:54] Hm. The reason I tried what I didn't wasn't just that I was dropping in setuptools in place of distutils, but also that the setuptools docs suggest "scripts=['say_hello.py']". [17:44:57] But that doesn't seem to work for me. [17:46:06] Which docs? [17:47:10] http://peak.telecommunity.com/DevCenter/setuptools [17:47:18] search for "scripts =" [17:49:01] Probably an old example [17:51:36] Is there a bug tracker for setuptools? [17:54:19] no clue [17:54:39] pje: SYN [17:58:35] Sigh... There is no mention of how to uninstall in the manual, except for develop mode. I do not think that I am using develop mode. [17:58:51] I mean, how are end users supposed to uninstall? [17:59:10] zooko: You just delete the egg [17:59:19] What about the .pth file? [17:59:27] if you use the windows installer stuff that creates an installer [17:59:38] It would be nice if the manual said "To uninstall, you just delete the egg.". [17:59:42] zooko: You can just leave that, since it won't affect anything else [17:59:52] zooko: Thats general *nix practice [18:00:00] There isn't a real uninstall system [18:00:16] But general practice is that you are able to delete everything that the package did (e.g. with GNU stow). [18:00:25] In this case, I don't know how to undo what it did to the easy_install.pth file. [18:00:32] And I don't know if what it did is important to undo. [18:00:41] Since the manual doesn't mention it one way or the other. [18:00:44] The idea of setuptools is the same as stow [18:01:01] it just puts everything all in one bundle [18:01:07] remove the bundle and youre done [18:02:48] But it also writes files into my c:\Python25\scripts\. [18:03:10] Only if you tell it to, and nothing of any consequence [18:03:21] They are just wrappers to call into the bundle [18:03:56] * zooko laughs. [18:04:04] This is different from the GNU stow philosophy. [18:04:27] GNU stow is that stow can uninstall your package and nothing will be left behind. Really nothing! [18:04:49] setuptools appears to be that you can uninstall your package and the only things that will be left behind are not important or probably won't cause future problems... [18:05:06] zooko: When you remove the egg no code or assets are left behind [18:05:30] * zooko shakes his head. [18:05:36] There is no way in *nix to make a useful, cross-platform uninstaller, each system does it differently [18:06:01] And as you can see, the stow approach breaks a lot of things expecting a normal FS layout [18:06:02] GNU stow seems to work fine for me, except for a couple of apps (including setuptools). [18:06:11] Let me think... [18:06:17] zooko: So it works except when it doesnt? ;-) [18:06:41] Apps shouldn't expect to know where in the filesystem they will be installed, right? [18:06:59] Another approach (a la ports/apt/rpm) is to track what files belong to what package [18:07:06] I remember that I had to pass special flags to xemacs when I built it to persuade it not to try to load lisp files from the place it was installed. [18:07:33] And I think I had a problem with ... What was it.. Some Python thing that I had to teach it not to assume that it knew where it was installed. [18:07:37] zooko: "Shouldn't" and "Don't" are unrelated [18:08:36] You wrote that the stow approach breaks "a lot of things", but I've tried a few hundred different apps in gnu stow so far, and it was 97 worked flawlessly, two required special configuration, and one, setuptools, I still can't figure out how to make it work. [18:09:15] Anyway, this isn't #stow, so let's talk about setuptools! [18:09:16] zooko: 97+2+1 < a few hundred [18:09:38] My main problem is that I can't seem to use it to build executables/scripts. [18:09:56] Correct, not in the unmanaged mode [18:10:08] (which is what you would want to use with stow) [18:10:23] No, these are orthogonal issues at the moment. [18:10:34] Okay, so in the normal mode [18:10:41] I very much want to learn to tame setuptools so it will work with stow, but more urgently I want to build executable scripts on Windows, without the use of stow. [18:10:55] You have the console-scripts extn point setup? [18:11:03] MAIN yumyum:~$ l /usr/local/stow/* | wc -l [18:11:03] 85 [18:11:03] [18:11:15] I've had many others that are not currently present in that dir, so "100" is a fair estimate. [18:11:19] But anyway... [18:11:42] Yes, but .. Well this is probably not setuptools's fault, but it doesn't seem to be including the subdir of my package which contains the entry point. [18:11:51] I took out the "scripts=". [18:12:05] What do you have in package=? [18:12:35] Oh I bet I know -- it is because my scripts don't have .py in their names? [18:12:36] * zooko tries it. [18:12:58] You don't just give it a script [18:13:06] You give it a function in a module [18:13:23] The script itself is generated dynamically [18:13:51] Yep, that was it. [18:14:04] I wish there were a bug tracker... [18:16:06] Hm. Now my script entry point code gets ImportError when attempting to import my other code... [18:17:04] I can write "python -c 'from zfec.util import argparse'" [18:17:20] but when my entry-point script executes "from zfec.util import argparse", it gets an ImportError. [18:17:46] Any funkiness with $PYTHONPATH? [18:17:55] Where did it install the egg to [18:18:10] No. [18:18:14] It installed the egg to [18:18:42] /c/Python25/Lib/site-packages/zfec-1.0.0a3-py2.5-win32.egg/ [18:18:48] (in cygwin path notation) [18:19:19] I don't know how well the cygwin python and the windows native python will get along [18:19:27] ive had issues with crossing them before [18:19:50] There is only windows native python on this machine. [18:19:57] Ahh, okay [18:20:21] You mentioned "unmanaged" mode as a way to get around the gnu stow conflict. Looking at the wiki page gives me hits for "unmanaged" only within the changelog. [18:20:29] Is there some more doc I should know about besides that page? [18:23:10] Its something along the lines of --single-version-externally-managed [18:23:16] but I forget the exact option [18:23:16] Heh. [18:25:17] Wow, I actually got it right [18:25:24] do python setup.py --help install [18:25:49] Thanks! [18:26:15] So that would work to integrate with stow. [18:26:30] Is there any other way to make it .. Let me think. I think the only conflicts I have are with the .pth files. [18:26:36] It should, it reverts it back to a more distutilsy behavior [18:26:57] Is there a way to tell it "install all files $HERE, but update the .pth file $THERE"? [18:27:37] I would have to look at the setuptools code and see how it locates easy_install.pth [18:27:54] Oh, also the site.py and site.pyc. [18:28:00] Those are the three things that ... [18:28:20] Yep, if I could tell it that those three things live in a special global space, different from the target where it should install the actual app, that would be good. [18:28:21] Hm. [18:28:29] I could hack it with an external tool... [18:28:50] Anyway, I can't figure out why my script can't import my package. [18:28:57] I'll add printouts of the current value of sys.path... [18:29:44] The .egg dir *is* on the sys.path! [18:31:21] Weird. [18:31:38] Check for the needed __init__.py files perhaps? [18:31:39] I ran python, deleted the contents of sys.path, inserted into sys.path the contents that are present when my script runs... [18:31:44] Then I am able to .. [18:31:47] Okay jsut a sec. [18:32:30] Yep, all __init__.py are there. [18:32:44] But see how the sys.path is actually correct, but I get an ImportError? That's weird. [18:36:46] http://rafb.net/p/6EeW7E91.txt [18:37:13] This shows how import fails inside the script but succeed at the command-line, even with identical sys.path. [18:38:48] zooko: This falls into "Ask PJE" territory [18:40:25] I'll bet it is due to the compiled extension module I have in there. [18:40:25] Hm. [18:41:47] there's not enough information in that trace to give me any clue as to what's going on, I'm afraid. [18:41:48] Hee hee. It is recursively defined. The module "zfec" has an attribute named "zfec" which is itself. [18:41:52] So I can print "zfec.zfec.zfec.zfec". [18:41:55] pje: Thanks for looking atit. [18:42:03] I'll keep exploring for a little while... [18:42:11] Ah right. [18:42:24] I have a package named zfec, and I also have a module named zfec/cmdline/zfec.py. [18:42:51] Someone has gotten confused, and made it so that... that... The resulting installed "zfec" package has only one attribute (aside from __builtins__, sys, etc.) [18:43:02] and that attribute is, AFAICT, a reference to the package itself. [18:43:08] Now changing the name of one of those things... [18:44:00] actually, I think I see your problem. [18:44:19] "from zfec.util import argparse" is being interpreted as a relative import [18:44:55] it's looking at zfec.cmdline.zfec as the zfec to import util from... which of course fails [18:45:04] Whee! Now it works. [18:45:44] you could probably also use from __future__ import absolute_import or whatever it's called [18:46:21] I would most like to have a relative import. the module in question lives in zfec/cmdline/zfec.py, and it needs to import zfec/util/argparse.py, so I would like to ask it to go up one level and then down to util. [18:49:02] from ..util import argparse [18:49:08] I think that's how in works in 2.5 [18:49:57] btw, zooko, if you look at the EasyInstall manual, it explains what you need to do to clean up the .pth before deleting an .egg [18:50:11] * pje just read back [18:50:27] http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages [18:51:25] Thanks for the tips. [18:51:53] Ah, so there *is* another document that I was missing. [18:52:40] Honestly, I don't understand the difference between "setuptools" and "EasyInstall" (and "ez_setup"). [18:53:00] yeah, "setup.py install" on a setuptools-based package is a shortcut for "easy_install ." with a few options passed through" [18:53:29] ez_setup.py is a bootstrap script that downloads a setuptools.egg and runs easy_install on it, giving it whatever cmdline opts you specify. [18:53:59] i.e. "ez_setup foo" -> "wget setuptools.egg; PYTHONPATH=setuptools.egg easy_install foo" [18:54:09] more or less, anyway. :) [18:59:21] I see. [19:15:59] pje: what did you think of my query about telling setuptools that the .pth and site.py files are in a different location than the rest? [19:17:06] I'd suggest simply installing to the stow target with -m, so no .pth/site stuff gets done. [19:17:45] If you want it to be added to a .pth file somewhere else, you can do: [19:18:05] PYTHONPATH=/path/to/the.egg easy_install projectname [19:18:18] this will leave the .egg in place, but add it to the default .pth [19:18:51] -m, btw, is an option to easy_install, not to "setup.py install", which has to stick w/distutils-compatible options [19:19:22] use "easy_install -md /path/under/stow ." instead of "setup.py install" in other words [19:19:58] then "PYTHONPATH=/path/under/stow/myproject-*.egg:$PYTHONPATH easy_install myproject [19:20:58] Thanks. [19:21:06] I've gotta run. Talk to you later! [19:25:49] * pje waves [20:25:19] ** mike8 has left IRC ("Ex-Chat") [21:01:37] ** pje has left IRC ("Client exiting")