diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ac42661
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build/
+dist/
+grin.egg-info/
diff --git a/README.txt b/README.rst
similarity index 87%
rename from README.txt
rename to README.rst
index 3529c02..170fa70 100644
--- a/README.txt
+++ b/README.rst
@@ -64,25 +64,13 @@ directories, I would have this line in my bashrc::
Installation
------------
-grin uses setuptools_ to find and install its dependency on argparse_. grin is
-easy_installable::
+Install using pip_::
- $ easy_install grin
+ $ pip install grin
-Alternatively, download and unpack the tarball and install::
+Running the unittests requires the nose_ framework::
- $ tar zxf grin-1.2.tar.gz
- $ python setup.py install
-
-On UNIX systems, use sudo for the latter command if you need to install the
-scripts to a directory that requires root privileges::
-
- $ sudo python setup.py install
-
-Running the unittests requires the nose_ framework, which can also be
-easy_installed::
-
- $ easy_install "nose >= 0.10"
+ $ pip install nose
...
$ nosetests
.........................
@@ -94,9 +82,9 @@ easy_installed::
running test
... etc.
-The development Subversion repository can be checked out anonymously::
+The development sources are hosted on Github:
- $ svn co https://svn.enthought.com/svn/sandbox/grin/trunk/ grin
+ https://github.com/rkern/grin
There is one little tweak to the installation that you may want to consider. By
default, setuptools installs scripts indirectly; the scripts installed to
@@ -108,9 +96,8 @@ response of grin to be snappier, I recommend installing custom scripts that just
import the grin module and run the appropriate main() function. See the files
examples/grin and examples/grind for examples.
-.. _setuptools : http://pypi.python.org/pypi/setuptools
-.. _argparse : http://argparse.python-hosting.com
-.. _nose : http://www.somethingaboutorange.com/mrl/projects/nose
+.. _pip : https://pip.pypa.io/en/stable/
+.. _nose : https://nose.readthedocs.org/en/latest/
Using grin
@@ -246,13 +233,12 @@ To Do
* Figure out the story for grepping UTF-8, UTF-16 and UTF-32 Unicode text files.
+* Python 3
+
Bugs and Such
-------------
-If you find a bug, or a missing feature you really want added, please post to
-the enthought-dev_ mailing list or email the author at
-<robert.kern@enthought.com>.
-
-.. _enthought-dev : https://mail.enthought.com/mailman/listinfo/enthought-dev
+Please make a new issue at the Github issue tracker.
+ https://github.com/rkern/grin
diff --git a/examples/grinimports.py b/examples/grinimports.py
index ef7cacb..b6d48ff 100755
--- a/examples/grinimports.py
+++ b/examples/grinimports.py
@@ -21,7 +21,7 @@ def normalize_From(node):
"""
statements = []
children = node.getChildren()
- module = children[0]
+ module = '.'*node.level + node.modname
for name, asname in children[1]:
line = 'from %s import %s' % (module, name)
if asname is not None:
diff --git a/grin.py b/grin.py
index de9703d..bf42dc0 100755
--- a/grin.py
+++ b/grin.py
@@ -906,12 +906,15 @@ def get_grind_arg_parser(parser=None):
def get_recognizer(args):
""" Get the file recognizer object from the configured options.
"""
+ # Make sure we have empty sets when we have empty strings.
+ skip_dirs = set([x for x in args.skip_dirs.split(',') if x])
+ skip_exts = set([x for x in args.skip_exts.split(',') if x])
fr = FileRecognizer(
skip_hidden_files=args.skip_hidden_files,
skip_backup_files=args.skip_backup_files,
skip_hidden_dirs=args.skip_hidden_dirs,
- skip_dirs=set(args.skip_dirs.split(',')),
- skip_exts=set(args.skip_exts.split(',')),
+ skip_dirs=skip_dirs,
+ skip_exts=skip_exts,
skip_symlink_files=not args.follow_symlinks,
skip_symlink_dirs=not args.follow_symlinks,
)
@@ -1029,7 +1032,7 @@ def grin_main(argv=None):
sys.stdout.write(report)
except KeyboardInterrupt:
raise SystemExit(0)
- except IOError as e:
+ except IOError, e:
if 'Broken pipe' in str(e):
# The user is probably piping to a pager like less(1) and has exited
# it. Just exit.
@@ -1070,7 +1073,7 @@ def grind_main(argv=None):
output(filename)
except KeyboardInterrupt:
raise SystemExit(0)
- except IOError as e:
+ except IOError, e:
if 'Broken pipe' in str(e):
# The user is probably piping to a pager like less(1) and has exited
# it. Just exit.
diff --git a/setup.py b/setup.py
index abf95d9..3d1f1eb 100644
--- a/setup.py
+++ b/setup.py
@@ -1,23 +1,24 @@
import os
+
from setuptools import setup
kwds = {}
# Read the long description from the README.txt
thisdir = os.path.abspath(os.path.dirname(__file__))
-f = open(os.path.join(thisdir, 'README.txt'))
-kwds['long_description'] = f.read()
-f.close()
+with open(os.path.join(thisdir, 'README.rst')) as f:
+ kwds['long_description'] = f.read()
setup(
- name = 'grin',
- version = '1.2.1',
- author = 'Robert Kern',
- author_email = 'robert.kern@enthought.com',
- description = "A grep program configured the way I like it.",
- license = "BSD",
- classifiers = [
+ name='grin',
+ version='1.2.1',
+ author='Robert Kern',
+ author_email='robert.kern@enthought.com',
+ description="A grep program configured the way I like it.",
+ license="BSD",
+ url='https://github.com/rkern/grin',
+ classifiers=[
"License :: OSI Approved :: BSD License",
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
@@ -26,20 +27,16 @@ setup(
"Programming Language :: Python",
"Topic :: Utilities",
],
-
- py_modules = ["grin"],
- entry_points = dict(
- console_scripts = [
+ py_modules=["grin"],
+ entry_points=dict(
+ console_scripts=[
"grin = grin:grin_main",
"grind = grin:grind_main",
],
),
- install_requires = [
- 'argparse >= 1.1',
- ],
- tests_require = [
+ tests_require=[
'nose >= 0.10',
],
- test_suite = 'nose.collector',
+ test_suite='nose.collector',
**kwds
)