comparison runtime/spell/pt/main.aap @ 1622:149d8b46404c

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 22:09:24 +0000
parents 82274b284600
children f4f8014d516e
comparison
equal deleted inserted replaced
1621:82b5078be2dd 1622:149d8b46404c
1 # Aap recipe for Portuguese Vim spell files. 1 # Aap recipe for Portuguese Vim spell files.
2 # 2 #
3 # Based on a shell script by Leonardo Fontenelle.
4 # His remarks:
5 #
6 # Makes a Vim pt dictionary from OpenOffice.org's pt_BR and pt_PT.
7 #
8 # AFAIK, will have to update the script every time a new dictionary is
9 # released for pt_BR. I asked the maintainer to update OOo's FTP site,
10 # but it didn't happen yet. As for the pt_PT dictionary, they won't be
11 # in OOo's FTP site for some time, because the Portuguese OOo project
12 # decided to adapt the pt_BR dictionary, which is much more extensive.
13 # I picked the Natura project unofficial dictionary, because it has been
14 # developed by a team with linguists, and for a longer time. At least the
15 # pt_PT dictionary has a "latest" file to make our lives easier.
16
17 3
18 # Use a freshly compiled Vim if it exists. 4 # Use a freshly compiled Vim if it exists.
19 @if os.path.exists('../../../src/vim'): 5 @if os.path.exists('../../../src/vim'):
20 VIM = ../../../src/vim 6 VIM = ../../../src/vim
21 @else: 7 @else:
31 PT_DIR = http://natura.di.uminho.pt/download/sources/Dictionaries/myspell 17 PT_DIR = http://natura.di.uminho.pt/download/sources/Dictionaries/myspell
32 PT_FNAME = myspell.pt-latest.zip 18 PT_FNAME = myspell.pt-latest.zip
33 :attr {fetch = $PT_DIR/%file%} $PT_FNAME 19 :attr {fetch = $PT_DIR/%file%} $PT_FNAME
34 20
35 # 21 #
36 # Fetching the pt_BR files from BrOffice.org (Brazilian OOo) 2.1. Should be 22 # Fetching the pt_BR files from BrOffice.org (Brazilian OOo).
37 # updated really soon.
38 # 23 #
39 BR_BASENAME = pt_BR-2007-04-11 24 BR_FNAME = pt_BR-V.zip
40 BR_DIR = http://www.deso-se.com.br/downloads/download.php?arquivo=$BR_BASENAME 25 BR_DIR = http://www.deso-se.com.br/downloads/broffice.org/$(BR_FNAME)
41 BR_FNAME = $(BR_BASENAME).zip
42
43 :attr {fetch = $BR_DIR} $BR_FNAME 26 :attr {fetch = $BR_DIR} $BR_FNAME
44 27
45 all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \ 28 all: $SPELLDIR/pt.latin1.spl $SPELLDIR/pt.utf-8.spl \
46 ../README_pt.txt 29 ../README_pt.txt
47 30
56 ../README_pt.txt: README_pt_PT.txt README_pt_BR.txt 39 ../README_pt.txt: README_pt_PT.txt README_pt_BR.txt
57 :print pt_PT >!$target 40 :print pt_PT >!$target
58 :cat README_pt_PT.txt | :eval re.sub('\r', '', stdin) >>$target 41 :cat README_pt_PT.txt | :eval re.sub('\r', '', stdin) >>$target
59 :print =================================================== >>$target 42 :print =================================================== >>$target
60 :print pt_BR: >>$target 43 :print pt_BR: >>$target
61 :print Information is in Leia-me.pdf, see $BR_DIR >>$target 44 :cat README_pt_BR.txt | :eval re.sub('\r', '', stdin) >>$target
62 :cat README_pt_BR.txt >>$target
63 45
64 # The files don't depend on the .zip file so that we can delete it. 46 # The files don't depend on the .zip file so that we can delete it.
65 # Only download the zip file if the targets don't exist. 47 # Only download the zip file if the targets don't exist.
66 pt_PT.aff pt_PT.dic: {buildcheck=} 48 pt_PT.aff pt_PT.dic: {buildcheck=}
67 :assertpkg unzip patch 49 :assertpkg unzip patch
83 pt_BR.aff pt_BR.dic: {buildcheck=} 65 pt_BR.aff pt_BR.dic: {buildcheck=}
84 :assertpkg unzip patch 66 :assertpkg unzip patch
85 :fetch $BR_FNAME 67 :fetch $BR_FNAME
86 :sys $UNZIP $BR_FNAME 68 :sys $UNZIP $BR_FNAME
87 :delete $BR_FNAME 69 :delete $BR_FNAME
88 :move Leia-me.pdf Leia-me_pt_BR.pdf 70 :sys $VIM README_pt_BR.TXT -e -c "set ff=unix" -c update -c q
71 :move README_pt_BR.TXT README_pt_BR.txt
89 72
90 # 1. pt_BR.dic contains a cp1252-specific character. 73 # Vim seems to ignore the dots from the word list.
91 # Changing it to its latin1 equivalent. 74 # Removing words with dot to avoid misbehaviour.
92 # 2. Vim seems to ignore the dots from the word list. 75 :sys $VIM pt_BR.dic -e -c "set ff=unix" -c "/\./d" -c update -c q
93 # Removing words with dot to avoid misbehaviour. 76 :sys $VIM pt_BR.aff -e -c "set ff=unix" -c update -c q
94 :sys $VIM pt_BR.dic -e -c "set ff=unix" -c "%s/\%x92/'/g" -c "/\./d" -c update -c q
95
96 # Removing /* ... */ header to avoid warnings. Write it to the README file, it
97 # contains the copyright notice.
98 :sys $VIM pt_BR.aff -e -c "set ff=unix" -c "/\/\*/,/\*\//w! README_pt_BR.txt" -c "/\/\*/,/\*\//+1d" -c update -c q
99
100 #:sys $VIM README_pt_BR.txt -e -c "set ff=unix" -c update -c q
101 @if not os.path.exists('pt_BR.orig.aff'): 77 @if not os.path.exists('pt_BR.orig.aff'):
102 :copy pt_BR.aff pt_BR.orig.aff 78 :copy pt_BR.aff pt_BR.orig.aff
103 @if not os.path.exists('pt_BR.orig.dic'): 79 @if not os.path.exists('pt_BR.orig.dic'):
104 :copy pt_BR.dic pt_BR.orig.dic 80 :copy pt_BR.dic pt_BR.orig.dic
105 @if os.path.exists('pt_BR.diff'): 81 @if os.path.exists('pt_BR.diff'):
123 99
124 check: check-pt check-br 100 check: check-pt check-br
125 101
126 check-pt: 102 check-pt:
127 :assertpkg unzip diff 103 :assertpkg unzip diff
128 :fetch pt_PT.zip 104 :fetch $PT_FNAME
129 :mkdir tmp 105 :mkdir tmp
130 :cd tmp 106 :cd tmp
131 @try: 107 @try:
132 @import stat 108 @import stat
133 :sys $UNZIP ../pt_PT.zip 109 :sys $UNZIP ../$PT_FNAME
134 :sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d 110 :sys {force} diff ../pt_PT.orig.aff pt_PT.aff >d
135 @if os.stat('d')[stat.ST_SIZE] > 0: 111 @if os.stat('d')[stat.ST_SIZE] > 0:
136 :copy pt_PT.aff ../pt_PT.new.aff 112 :copy pt_PT.aff ../pt_PT.new.aff
137 :sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d 113 :sys {force} diff ../pt_PT.orig.dic pt_PT.dic >d
138 @if os.stat('d')[stat.ST_SIZE] > 0: 114 @if os.stat('d')[stat.ST_SIZE] > 0:
139 :copy pt_PT.dic ../pt_PT.new.dic 115 :copy pt_PT.dic ../pt_PT.new.dic
140 @finally: 116 @finally:
141 :cd .. 117 :cd ..
142 :delete {r}{f}{q} tmp 118 :delete {r}{f}{q} tmp
143 :delete pt_PT.zip 119 :delete $PT_FNAME
144 120
145 check-br: 121 check-br:
146 :assertpkg unzip diff 122 :assertpkg unzip diff
147 :fetch pt_BR.zip 123 :fetch $BR_FNAME
148 :mkdir tmp 124 :mkdir tmp
149 :cd tmp 125 :cd tmp
150 @try: 126 @try:
151 @import stat 127 @import stat
152 :sys $UNZIP ../pt_BR.zip 128 :sys $UNZIP ../$BR_FNAME
153 :sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d 129 :sys {force} diff ../pt_BR.orig.aff pt_BR.aff >d
154 @if os.stat('d')[stat.ST_SIZE] > 0: 130 @if os.stat('d')[stat.ST_SIZE] > 0:
155 :copy pt_BR.aff ../pt_BR.new.aff 131 :copy pt_BR.aff ../pt_BR.new.aff
156 :sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d 132 :sys {force} diff ../pt_BR.orig.dic pt_BR.dic >d
157 @if os.stat('d')[stat.ST_SIZE] > 0: 133 @if os.stat('d')[stat.ST_SIZE] > 0:
158 :copy pt_BR.dic ../pt_BR.new.dic 134 :copy pt_BR.dic ../pt_BR.new.dic
159 @finally: 135 @finally:
160 :cd .. 136 :cd ..
161 :delete {r}{f}{q} tmp 137 :delete {r}{f}{q} tmp
162 :delete pt_BR.zip 138 :delete $BR_FNAME
163 139
164 # vim: set sts=4 sw=4 : 140 # vim: set sts=4 sw=4 :