- Use the setuptools entry_points mechanism
- Move the primary bpython script itself into the bpython module with
invocation via the setuptools entry_points mechanism.
- Fix setup.py whitespace to be consistant (4-spaces only)
- Ignore setuptools-generated build products
Changed the way it parses and executes the file so that it actually does
execute it now; not sure what the problem was before exactly but it's fixed
now.
I've never used this feature but Thorsten Kampe reported problems with it.
Unfortunately the way I was parsing the file was line-by-line which was causing
bpython to blow up when it encountered a double line-break, which was pretty
stupid on my part. It now takes the whole file at once.
There's now a fake stdin object instantiated when the curses interface loads
which hooks in to the interface and calls a get_key method on it (some
refactoring done to make this work cleanly). I've only provided a readline()
method on this object (write, writelines and read are there too but no-ops) as
I can't think of any other use for reading from stdin in the interactive
interpreter.
For political reasons I have made pyparsing and pygments actual dependencies.
It seems that unless bpython actually won't work without these two packages
then certain Norwegian people will not package bpython for Ubuntu with them
as actual dependencies, meaning people would have to apt-get install them
separately (by which point they would probably have decided bpython sucks and
won't ever use it again). Jorgen is right, though - they are a huge part
of what makes bpython what it is, so they should be dependencies.
The extra linebreak was irritating but I didn't notice it on my setup because I
already have a linebreak on exit, or something. Also C-d now only exits if
there's a blank line, as per the vanilla interpreter.
Now bpython doesn't go wrong if you do, e.g.:
print "abc", "def", "ghi"
I was handling stdout faking in a really peculiar way, for some reason.
Now I don't and it works fine, go figure.
No idea how I didn't notice this one sooner; I think it was just there
in my periphery and I got used to it and forgot it was actually there,
but now the rightmost column gets fully used. I also fixed another
couple of little bugs that don't come up very often.
As far as I know this should run fine on 2.4 without any problems.
Thanks a bunch to Seamus for making me have to write ugly code to make
bpython compatible with his computer from the 1800s.
Oops, messed up a little. Hopefully everything's okay. I moved
internal.py to _internal.py so it isn't cluttering the namespace so
much, and also I forgot to mention that I wrote a config parser using
shlex so you can set any attribute of the OPTS object now, e.g.
auto_display_list
syntax
arg_spec
Now there's an option to require hitting tab to display the completion
window instead of having it pop up automatically as you type. You need
to edit the source at the moment (change OPTS.auto_display_list), the
next commit should have config file support.
A few people pointed out that help() can cause problems, specifically
when the help string is really big, so I've internalised it and injected
my own help() function into the interpreter which pages the output, but
it's pretty ghetto so I'm open to suggestions for improvement.
That said, it's pretty obvious that scrolling up and down (like less)
would be the main requested improvement so I should get to work on that
at some point.
Things like C-p and C-n and all that were just being echoed as ^P, and
only one character was being put into the buffer, whereas two were being
echoed. Now only printable characters are accepted for regular input.
Olivier Grisel pointed out that bpython ignores the PYTHONSTARTUP
variable. I never used it but the code was simple enough, cited here:
http://docs.python.org/tut/node4.html#startup
It's not much code at all, but let me know if it breaks anything (I
don't see why it should).
scapy seems to have a bug in it in that it expects stdout to have a
flush() method, which is not specified in the documentation for the sys
module (it specifies that it requires only a write() method to be
acceptable). So this is a hack to fix it, it's harmless though.
Ben Ford pointed out that the escape key can cause things to go a little
awry, I've fixed that and added another fix for potential breakage that
hadn't come up before.