diff --git a/.gitignore b/.gitignore index 0d20b64..55fe60d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pyc +*.egg-info +build +dist diff --git a/bpython.py b/bpython/cli.py similarity index 99% rename from bpython.py rename to bpython/cli.py index b774dd6..c07bbb6 100644 --- a/bpython.py +++ b/bpython/cli.py @@ -1538,7 +1538,7 @@ def loadrc(): stdscr = None -def main( scr ): +def main_curses( scr ): """main function for the curses convenience wrapper Initialise the two main objects: the interpreter @@ -1580,10 +1580,10 @@ def main( scr ): return repl.getstdout() -if __name__ == '__main__': +def main(): tb = None try: - o = curses.wrapper( main ) + o = curses.wrapper( main_curses ) except: tb = traceback.format_exc() # I don't know why this is necessary; without it the wrapper doesn't always @@ -1601,3 +1601,6 @@ if __name__ == '__main__': sys.stdout.write( o ) # Fake stdout data so everything's still visible after exiting sys.stdout.flush() + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py index 17de1d1..990a4d0 100644 --- a/setup.py +++ b/setup.py @@ -1,57 +1,41 @@ #!/usr/bin/env python -from distutils.command.install_data import install_data -from distutils.sysconfig import get_python_lib -from distutils.core import setup, Extension -from distutils.dep_util import newer -from distutils.log import info -from distutils import sysconfig -import distutils.file_util -import distutils.dir_util +# -*- coding: utf-8 -*- + +from setuptools import setup import sys, os import glob import platform import re -# Make distutils copy bpython.py to bpython -copy_file_orig = distutils.file_util.copy_file -copy_tree_orig = distutils.dir_util.copy_tree -def copy_file(src, dst, *args, **kwargs): - if dst.endswith("bin/bpython.py"): - dst = dst[:-3] - return copy_file_orig(src, dst, *args, **kwargs) -def copy_tree(*args, **kwargs): - outputs = copy_tree_orig(*args, **kwargs) - for i in range(len(outputs)): - if outputs[i].endswith("bin/bpython.py"): - outputs[i] = outputs[i][:-3] - return outputs -distutils.file_util.copy_file = copy_file -distutils.dir_util.copy_tree = copy_tree - -PYTHONLIB = os.path.join(get_python_lib(standard_lib=1, prefix=""), - "site-packages") - if platform.system() == 'FreeBSD': man_dir = 'man' else: man_dir = 'share/man' -setup(name="bpython", - version = "0.6.4", - description = "Fancy Interface to the Python Interpreter", - author = "Robert Anthony Farrell", - author_email = "robertanthonyfarrell@gmail.com", - license = "MIT/X", - url = "http://www.noiseforfree.com/bpython/", - long_description = -"""\ -bpython is a fancy interface to the Python interpreter for Unix-like operating systems. -""", - packages = ["bpython"], - scripts = ["bpython.py"], - data_files = [ - (os.path.join(man_dir, 'man1'), ['doc/bpython.1']), - (os.path.join(man_dir, 'man5'), ['doc/bpythonrc.5']), - ('share/applications', ['data/bpython.desktop']) - ] - ) +setup( + name="bpython", + version = "0.6.4", + author = "Robert Anthony Farrell", + author_email = "robertanthonyfarrell@gmail.com", + description = "Fancy Interface to the Python Interpreter", + license = "MIT/X", + url = "http://www.noiseforfree.com/bpython/", + long_description = """bpython is a fancy interface to the Python interpreter for Unix-like operating systems.""", + install_requires = [ + 'pygments', + 'pyparsing', + ], + packages = ["bpython"], + data_files = [ + (os.path.join(man_dir, 'man1'), ['doc/bpython.1']), + (os.path.join(man_dir, 'man5'), ['doc/bpythonrc.5']), + ('share/applications', ['data/bpython.desktop']) + ], + entry_points = { + 'console_scripts': [ + 'bpython = bpython.cli:main' + ], + } +) + +# vim: encoding=utf-8 sw=4 ts=4 sts=4 ai et sta