Преглед изворни кода

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

Matthew Wang пре 11 година
родитељ
комит
98f63f6df4
4 измењених фајлова са 67 додато и 4 уклоњено
  1. 3
    0
      .gitignore
  2. 7
    1
      Makefile
  3. 19
    3
      README.md
  4. 38
    0
      setup.py

+ 3
- 0
.gitignore Прегледај датотеку

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

+ 7
- 1
Makefile Прегледај датотеку

2
 
2
 
3
 TESTS = git svn crlf strange
3
 TESTS = git svn crlf strange
4
 
4
 
5
-.PHONY: dogfood test $(TESTS)
5
+.PHONY: dogfood test $(TESTS) clean sdist
6
 
6
 
7
 dogfood:
7
 dogfood:
8
 	src/cdiff.py -s
8
 	src/cdiff.py -s
19
 	python3 src/cdiff.py tests/$@.diff -s
19
 	python3 src/cdiff.py tests/$@.diff -s
20
 	python3 src/cdiff.py tests/$@.diff | diff -u tests/$@.diff -
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
 # vim:set noet ts=8 sw=8:
28
 # vim:set noet ts=8 sw=8:

+ 19
- 3
README.md Прегледај датотеку

1
 ## About
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
 ![Default](http://ymattw.github.com/cdiff/img/default.png)
6
 ![Default](http://ymattw.github.com/cdiff/img/default.png)
7
 ![Side by side](http://ymattw.github.com/cdiff/img/side-by-side.png)
7
 ![Side by side](http://ymattw.github.com/cdiff/img/side-by-side.png)
8
 
8
 
9
 ## Installation
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
 Save [src/cdiff.py](https://raw.github.com/ymattw/cdiff/master/src/cdiff.py) to
16
 Save [src/cdiff.py](https://raw.github.com/ymattw/cdiff/master/src/cdiff.py) to
12
 whatever directory which is in your `$PATH`, for example, `$HOME/bin` is in my
17
 whatever directory which is in your `$PATH`, for example, `$HOME/bin` is in my
13
 `$PATH`, so I save the script there and name as `cdiff`.
18
 `$PATH`, so I save the script there and name as `cdiff`.
15
     curl -ksS https://raw.github.com/ymattw/cdiff/master/src/cdiff.py > ~/bin/cdiff
20
     curl -ksS https://raw.github.com/ymattw/cdiff/master/src/cdiff.py > ~/bin/cdiff
16
     chmod +x ~/bin/cdiff
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
 ## Usage
34
 ## Usage
19
 
35
 
20
 Cdiff reads diff from diff (patch) file if given, or stdin if redirected, or
36
 Cdiff reads diff from diff (patch) file if given, or stdin if redirected, or
29
 View a diff (patch) file:
45
 View a diff (patch) file:
30
 
46
 
31
     cdiff foo.patch             # view incremental, colored udiff
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
     cdiff foo.patch -s -w 90    # use text width 90 other than default 80
49
     cdiff foo.patch -s -w 90    # use text width 90 other than default 80
34
 
50
 
35
 Read diff from local modification in a svn, git, or hg workspace:
51
 Read diff from local modification in a svn, git, or hg workspace:

+ 38
- 0
setup.py Прегледај датотеку

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
+)