Browse Source

New setup.py and document/make targets update for issue #1

Matthew Wang 11 years ago
parent
commit
98f63f6df4
4 changed files with 67 additions and 4 deletions
  1. 3
    0
      .gitignore
  2. 7
    1
      Makefile
  3. 19
    3
      README.md
  4. 38
    0
      setup.py

+ 3
- 0
.gitignore View File

@@ -1,2 +1,5 @@
1 1
 *.pyc
2 2
 *~
3
+build/
4
+cdiff.egg-info/
5
+dist/

+ 7
- 1
Makefile View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 TESTS = git svn crlf strange
4 4
 
5
-.PHONY: dogfood test $(TESTS)
5
+.PHONY: dogfood test $(TESTS) clean sdist
6 6
 
7 7
 dogfood:
8 8
 	src/cdiff.py -s
@@ -19,4 +19,10 @@ $(TESTS):
19 19
 	python3 src/cdiff.py tests/$@.diff -s
20 20
 	python3 src/cdiff.py tests/$@.diff | diff -u tests/$@.diff -
21 21
 
22
+clean:
23
+	rm -rf build/ cdiff.egg-info/ dist/
24
+
25
+sdist:
26
+	./setup.py sdist
27
+
22 28
 # vim:set noet ts=8 sw=8:

+ 19
- 3
README.md View File

@@ -1,13 +1,18 @@
1 1
 ## About
2 2
 
3
-View **incremental**, **colored** diff in unified format or in **side by side**
4
-mode with **auto pager**.  Requires python (>= 2.5.0) and `less`.
3
+View **incremental**, **colored** diff in unified format or **side by side**
4
+with **auto pager**.  Requires python (>= 2.5.0) and `less`.
5 5
 
6 6
 ![Default](http://ymattw.github.com/cdiff/img/default.png)
7 7
 ![Side by side](http://ymattw.github.com/cdiff/img/side-by-side.png)
8 8
 
9 9
 ## Installation
10 10
 
11
+Cdiff is not in PyPI yet, so far you could download the script directly or use
12
+the `setup.py` to install.
13
+ 
14
+**Download directly**
15
+
11 16
 Save [src/cdiff.py](https://raw.github.com/ymattw/cdiff/master/src/cdiff.py) to
12 17
 whatever directory which is in your `$PATH`, for example, `$HOME/bin` is in my
13 18
 `$PATH`, so I save the script there and name as `cdiff`.
@@ -15,6 +20,17 @@ whatever directory which is in your `$PATH`, for example, `$HOME/bin` is in my
15 20
     curl -ksS https://raw.github.com/ymattw/cdiff/master/src/cdiff.py > ~/bin/cdiff
16 21
     chmod +x ~/bin/cdiff
17 22
 
23
+**Install with the setup.py**
24
+
25
+You can run the setup.py from the source to install `cdiff` to system wide
26
+directory.
27
+
28
+    git clone https://github.com/ymattw/cdiff.git
29
+    cd cdiff
30
+    sudo ./setup.py install
31
+
32
+This usually installs it as `/usr/local/bin/cdiff`.
33
+
18 34
 ## Usage
19 35
 
20 36
 Cdiff reads diff from diff (patch) file if given, or stdin if redirected, or
@@ -29,7 +45,7 @@ Show usage:
29 45
 View a diff (patch) file:
30 46
 
31 47
     cdiff foo.patch             # view incremental, colored udiff
32
-    cdiff foo.patch -s          # view in side by side mode
48
+    cdiff foo.patch -s          # view side by side
33 49
     cdiff foo.patch -s -w 90    # use text width 90 other than default 80
34 50
 
35 51
 Read diff from local modification in a svn, git, or hg workspace:

+ 38
- 0
setup.py View File

@@ -0,0 +1,38 @@
1
+#!/usr/bin/env python
2
+
3
+from __future__ import with_statement
4
+from setuptools import setup
5
+
6
+with open('README.md') as doc:
7
+    long_description = doc.read()
8
+
9
+setup(
10
+    name = 'cdiff',
11
+    version = '0.0.1',
12
+    author = 'Matthew Wang',
13
+    author_email = 'mattwyl@gmail.com',
14
+    license = 'BSD-3',
15
+    description = ('View incremental, colored diff in unified format or side '
16
+                   'by side with auto pager'),
17
+    long_description = long_description,
18
+    keywords = 'incremental colored side-by-side diff',
19
+    url = 'https://github.com/ymattw/cdiff',
20
+    classifiers = [
21
+        'Development Status :: 3 - Alpha',
22
+        'Topic :: Utilities',
23
+        'License :: OSI Approved :: BSD License',
24
+        'Environment :: Console',
25
+        'Intended Audience :: Developers',
26
+        'Operating System :: MacOS :: MacOS X',
27
+        'Operating System :: POSIX',
28
+        'Operating System :: Unix',
29
+        'Programming Language :: Python',
30
+    ],
31
+    packages = [],
32
+    scripts = ['src/cdiff.py'],
33
+    entry_points = {
34
+        'console_scripts': [
35
+            'cdiff = cdiff:main',
36
+        ],
37
+    },
38
+)