diff -ru aap-1.091.orig/main.aap aap-1.091/main.aap
old
|
new
|
|
5 | 5 | :attr all {comment = Same as "test"} |
6 | 6 | :attr clean {comment = Cleanup after testing} |
7 | 7 | :attr fetch {comment = Obtain latest version from CVS} |
8 | | :attr install {comment = Install Aap; use PREFIX=path to specify where; use FULLDOCS=no to skip installing HTML and PDF docs; use HTMLDIR=/html to install HTML files in a subdirectory} |
| 8 | :attr install {comment = Install Aap; use PREFIX=path and/or DESTDIR=path to specify where; use FULLDOCS=no to skip installing HTML and PDF docs; use HTMLDIR=/html to install HTML files in a subdirectory} |
9 | 9 | :attr uninstall {comment = Uninstall current version of Aap; use PREFIX=path to specify where; use VERSION=1.123 to specify a different version} |
10 | 10 | :attr tags {comment = Create a tags file (requires Exuberant ctags)} |
11 | 11 | |
… |
… |
|
31 | 31 | install: |
32 | 32 | @if os.name == 'posix': |
33 | 33 | PREFIX = `os.path.expanduser(_no.PREFIX)` |
34 | | @if not os.access(_no.PREFIX, os.W_OK): |
35 | | @if os.access(_no.PREFIX, os.R_OK): |
36 | | :error Install directory is not writable: $PREFIX |
37 | | @r = raw_input(('\nThe $PREFIX directory does not exist: "%s"\n' |
38 | | @ % _no.PREFIX) + |
| 34 | DESTDIR = $DESTDIR/$PREFIX |
| 35 | @if not os.access(_no.DESTDIR, os.W_OK): |
| 36 | @if os.access(_no.DESTDIR, os.R_OK): |
| 37 | :error Install directory is not writable: $DESTDIR |
| 38 | @r = raw_input(('\nThe $DESTDIR directory does not exist: "%s"\n' |
| 39 | @ % _no.DESTDIR) + |
39 | 40 | @ "Do you want to try creating it? (y/n) ") |
40 | 41 | @if not r or (r[0] != 'y' and r[0] != 'Y'): |
41 | | :error Install directory does not exist: $PREFIX |
42 | | :mkdir {r} $PREFIX |
| 42 | :error Install directory does not exist: $DESTDIR |
| 43 | :mkdir {r} $DESTDIR |
43 | 44 | |
44 | 45 | # Get the version string from AapVersion.py, because $VERSIONSTR is |
45 | 46 | # from the current Aap, which may be older. |
… |
… |
|
47 | 48 | stdin).group(1) | :assign Version |
48 | 49 | |
49 | 50 | # Directories to be used. |
50 | | dir = $PREFIX/lib/aap/Exec-$Version |
| 51 | dir = $DESTDIR/lib/aap/Exec-$Version |
51 | 52 | toolsdir = $dir/tools |
52 | 53 | modulesdir = $dir/modules |
53 | 54 | docdir = $dir/doc |
54 | 55 | htmldocdir = $docdir$?HTMLDIR |
55 | | bindir = $PREFIX/bin |
56 | | mandir = $PREFIX/man/man1 |
57 | | sharedocdir = $PREFIX/share/doc |
| 56 | bindir = $DESTDIR/bin |
| 57 | mandir = $DESTDIR/share/man/man1 |
| 58 | sharedocdir = $DESTDIR/share/doc |
58 | 59 | sharedocdiraap = $sharedocdir/aap |
59 | 60 | sharehtmldocdir = $sharedocdiraap$?HTMLDIR |
| 61 | prefixdir = $PREFIX/lib/aap/Exec-$Version |
| 62 | prefixdocdir = $dir/doc |
| 63 | prefixhtmldocdir = $docdir$?HTMLDIR |
| 64 | prefixsharedocdir = $PREFIX/share/doc |
| 65 | prefixsharedocdiraap = $sharedocdir/aap |
| 66 | prefixsharehtmldocdir = $sharedocdiraap$?HTMLDIR |
60 | 67 | |
61 | 68 | # Copy the files. |
62 | 69 | :mkdir {r}{f} $toolsdir $modulesdir |
… |
… |
|
73 | 80 | # Create symbolic links for the docs dir. |
74 | 81 | @if os.path.exists(sharedocdir): |
75 | 82 | :print Creating a symbolic link for "aap" in $sharedocdir |
76 | | :symlink {f} $docdir $sharedocdiraap |
77 | | indexstr = $sharehtmldocdir/index.html |
78 | | htmlstr = $sharehtmldocdir/*.html |
79 | | pdfstr = $sharedocdiraap/exec.pdf |
| 83 | :symlink {f} $prefixdocdir $sharedocdiraap |
| 84 | indexstr = $prefixsharehtmldocdir/index.html |
| 85 | htmlstr = $prefixsharehtmldocdir/*.html |
| 86 | pdfstr = $prefixsharedocdiraap/exec.pdf |
80 | 87 | @else: |
81 | 88 | indexstr = $htmldocdir/index.html |
82 | 89 | htmlstr = $htmldocdir/*.html |
… |
… |
|
116 | 123 | # Create symbolic links for the program. |
117 | 124 | :print Creating a symbolic link for "aap" in $bindir |
118 | 125 | :mkdir {f} $bindir |
119 | | :symlink {f} $dir/aap $bindir/aap |
| 126 | :symlink {f} $prefixdir/aap $bindir/aap |
120 | 127 | |
121 | 128 | @elif os.name in ["win32", "mswin", "nt"]: |
122 | 129 | # On MS-Windows we write an aap.bat file in the Windows directory. |
… |
… |
|
156 | 163 | uninstall: |
157 | 164 | @if os.name == 'posix': |
158 | 165 | PREFIX = `os.path.expanduser(_no.PREFIX)` |
159 | | @if not os.access(_no.PREFIX, os.W_OK): |
160 | | :error Install directory is not writable: $PREFIX |
| 166 | DESTDIR = $DESTDIR/$PREFIX |
| 167 | @if not os.access(_no.DESTDIR, os.W_OK): |
| 168 | :error Install directory is not writable: $DESTDIR |
161 | 169 | |
162 | 170 | # What version to uninstall? Default is what we are currently running. |
163 | 171 | VERSION ?= $VERSIONSTR |
164 | 172 | |
165 | | dir = $PREFIX/lib/aap/Exec-$VERSION |
166 | | mandir = $PREFIX/man/man1 |
| 173 | dir = $DESTDIR/lib/aap/Exec-$VERSION |
| 174 | mandir = $DESTDIR/share/man/man1 |
167 | 175 | |
168 | 176 | # Only delete the bin/aap and share/doc symlinks if they point to the |
169 | 177 | # version we uninstalled. |
170 | 178 | @try: |
171 | | n = $PREFIX/bin/aap |
| 179 | n = $DESTDIR/bin/aap |
172 | 180 | @if string.find(os.readlink(n), _no.VERSION) >= 0: |
173 | 181 | :del {f} $n |
174 | 182 | @except: |
175 | 183 | @ pass |
176 | 184 | |
177 | 185 | @try: |
178 | | n = $PREFIX/share/doc/aap |
| 186 | n = $DESTDIR/share/doc/aap |
179 | 187 | @if string.find(os.readlink(n), _no.VERSION) >= 0: |
180 | 188 | :del {f} $n |
181 | 189 | @except: |