Browse Source

Use wrapper `cdiff` instead of symlink for future unit test; doc update

Matthew Wang 11 years ago
parent
commit
329760c5c8
9 changed files with 31 additions and 17 deletions
  1. 0
    1
      .gitignore
  2. 5
    0
      CHANGES
  3. 0
    1
      MANIFEST.in
  4. 1
    1
      Makefile
  5. 3
    3
      README.rst
  6. 12
    0
      cdiff
  7. 2
    3
      cdiff.py
  8. 7
    7
      setup.py
  9. 1
    1
      tests/regression.sh

+ 0
- 1
.gitignore View File

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

+ 5
- 0
CHANGES View File

@@ -2,6 +2,11 @@
2 2
 Change log
3 3
 ==========
4 4
 
5
+Version 0.4 (2013-02-16)
6
+
7
+  - New option *-c WHEN* (*--color WHEN*) to support auto test
8
+  - Auto regression test now on Travis
9
+
5 10
 Version 0.3 (2013-02-07)
6 11
 
7 12
   - Support compare two files (wrapper of diff)

+ 0
- 1
MANIFEST.in View File

@@ -4,4 +4,3 @@ include Makefile
4 4
 include README.rst
5 5
 include tests/*
6 6
 include tests/*/*
7
-exclude cdiff

+ 1
- 1
Makefile View File

@@ -13,7 +13,7 @@ test:
13 13
 	tests/regression.sh
14 14
 
15 15
 clean:
16
-	rm -f cdiff MANIFEST
16
+	rm -f MANIFEST
17 17
 	rm -rf build/ cdiff.egg-info/ dist/ __pycache__/
18 18
 
19 19
 build:

+ 3
- 3
README.rst View File

@@ -29,7 +29,7 @@ install with ``pip`` if you have the tool.
29 29
 
30 30
 .. code:: sh
31 31
  
32
-    sudo pip install cdiff
32
+    pip install --upgrade cdiff
33 33
 
34 34
 Install with setup.py
35 35
 ~~~~~~~~~~~~~~~~~~~~~
@@ -40,7 +40,7 @@ You can also run the setup.py from the source if you don't have ``pip``.
40 40
 
41 41
     git clone https://github.com/ymattw/cdiff.git
42 42
     cd cdiff
43
-    sudo ./setup.py install
43
+    ./setup.py install
44 44
 
45 45
 Download directly
46 46
 ~~~~~~~~~~~~~~~~~
@@ -102,7 +102,7 @@ Redirect output to another patch file is safe:
102 102
 
103 103
 .. code:: sh
104 104
 
105
-    svn diff | cdiff -s > my.patch
105
+    svn diff -r PREV | cdiff -s > my.patch
106 106
 
107 107
 Notes
108 108
 -----

+ 12
- 0
cdiff View File

@@ -0,0 +1,12 @@
1
+#!/usr/bin/env python
2
+# -*- coding: utf-8 -*-
3
+
4
+import sys
5
+import cdiff
6
+
7
+try:
8
+    sys.exit(cdiff.main())
9
+except:
10
+    sys.exit(1)
11
+
12
+# vim:set et sts=4 sw=4 tw=80:

+ 2
- 3
cdiff.py View File

@@ -8,7 +8,7 @@ workspace, given patch or two files, or from stdin, with **side by side** and
8 8
 """
9 9
 
10 10
 META_INFO = {
11
-    'version'     : '0.3',
11
+    'version'     : '0.4',
12 12
     'license'     : 'BSD-3',
13 13
     'author'      : 'Matthew Wang',
14 14
     'email'       : 'mattwyl(@)gmail(.)com',
@@ -22,8 +22,7 @@ META_INFO = {
22 22
 import sys
23 23
 
24 24
 if sys.hexversion < 0x02050000:
25
-    sys.stderr.write("*** Requires python >= 2.5.0\n")
26
-    sys.exit(1)
25
+    raise SystemExit("*** Requires python >= 2.5.0")
27 26
 IS_PY3 = sys.hexversion >= 0x03000000
28 27
 
29 28
 import os

+ 7
- 7
setup.py View File

@@ -1,15 +1,14 @@
1 1
 #!/usr/bin/env python
2
+# -*- coding: utf-8 -*-
2 3
 
3 4
 from __future__ import with_statement
4 5
 from distutils.core import setup
5 6
 import os
6 7
 from cdiff import META_INFO as _meta
7 8
 
8
-# Create symlink so that to use 'scripts' w/o '.py'
9
-link_name = 'cdiff'
10
-if os.path.exists(link_name):
11
-    os.unlink(link_name)
12
-os.symlink('cdiff.py', link_name)
9
+import sys
10
+if sys.hexversion < 0x02050000:
11
+    raise SystemExit("*** Requires python >= 2.5.0")
13 12
 
14 13
 with open('README.rst') as doc:
15 14
     long_description = doc.read()
@@ -37,7 +36,8 @@ setup(
37 36
         'Operating System :: Unix',
38 37
         'Programming Language :: Python',
39 38
     ],
40
-    packages = [],
41 39
     py_modules = ['cdiff'],
42
-    scripts = [link_name],
40
+    scripts = ['cdiff'],
43 41
 )
42
+
43
+# vim:set et sts=4 sw=4 tw=80:

+ 1
- 1
tests/regression.sh View File

@@ -3,7 +3,7 @@
3 3
 set -o errexit
4 4
 
5 5
 SELF_DIR=$(cd $(dirname $0) && pwd) || exit 1
6
-CDIFF=$SELF_DIR/../cdiff.py
6
+CDIFF=$SELF_DIR/../cdiff
7 7
 
8 8
 function pass()
9 9
 {