Skip to content

Commit 5dc7891

Browse files
committed
Merge pull request msys2#1372 from JPeterMugaas/Devel
Some various things I wanted to add before I forget
2 parents cc93050 + 088ce30 commit 5dc7891

File tree

8 files changed

+1270
-6
lines changed

8 files changed

+1270
-6
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Maintainer: Some One <[email protected]>
2+
#This value is here because some python package names have capital letters
3+
#while there is a strong preference for lowercase letters in ArchLinux and
4+
#MSYS packages.
5+
_pyname=SomePackage
6+
_realname=somepackage
7+
pkgbase=mingw-w64-python-${_realname}
8+
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
9+
pkgver=1.0.0
10+
pkgrel=1
11+
pkgdesc="Some package (mingw-w64)"
12+
arch=('any')
13+
url='https://www.somepackage.org/'
14+
license=('LICENSE')
15+
validpgpkeys=('gpg_KEY')
16+
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
17+
"${MINGW_PACKAGE_PREFIX}-python3"
18+
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
19+
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
20+
options=('staticlibs' 'strip' '!debug')
21+
source=("https://pypi.python.org/packages/source/P/${_realname}/${_realname}-${pkgver}.tar.gz")
22+
"0001-An-important-fix.patch"
23+
"0002-A-less-important-fix.patch")
24+
sha256sums=('SKIP'
25+
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
26+
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb')
27+
28+
prepare() {
29+
cd "$srcdir"/
30+
patch -p1 -i ${srcdir}/0001-A-really-important-fix.patch
31+
patch -p1 -i ${srcdir}/0002-A-less-important-fix.patch
32+
for builddir in python{2,3}-build; do
33+
rm -rf $builddir | true
34+
cp -r "${_pyname}-${pkgver}" "${builddir}"
35+
done
36+
}
37+
38+
check() {
39+
for pver in {2,3}; do
40+
msg "Python ${pver} test for ${CARCH}"
41+
cd "${srcdir}/python${pver}-build"
42+
${MINGW_PREFIX}/bin/python${pver} setup.py check
43+
done
44+
}
45+
46+
# Note that build() is sometimes skipped because it's done in
47+
# the packages setup.py install for simplicity if you can do so.
48+
package_python3-somepackage() {
49+
depends=("${MINGW_PACKAGE_PREFIX}-python3")
50+
51+
cd "${srcdir}/python3-build"
52+
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
53+
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
54+
--root="${pkgdir}" --optimize=1
55+
56+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/COPYING"
57+
}
58+
59+
package_python2-somepackage() {
60+
depends=("${MINGW_PACKAGE_PREFIX}-python2")
61+
62+
cd "${srcdir}/python2-build"
63+
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
64+
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
65+
--root="${pkgdir}" --optimize=1
66+
67+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/COPYING"
68+
}
69+
70+
package_mingw-w64-i686-python2-somepackage() {
71+
package_python2-somepackage
72+
}
73+
74+
package_mingw-w64-i686-python3-somepackage() {
75+
package_python3-somepackage
76+
}
77+
78+
package_mingw-w64-x86_64-python2-somepackage() {
79+
package_python2-somepackage
80+
}
81+
82+
package_mingw-w64-x86_64-python3-somepackage() {
83+
package_python3-somepackage
84+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
From 6df43f8b17ff16e8b6124dee2bd47cbd05a89e30 Mon Sep 17 00:00:00 2001
2+
From: Anne-Edgar WILKE <[email protected]>
3+
Date: Fri, 28 Aug 2015 00:38:22 +0200
4+
Subject: [PATCH] Fix COMPOUNDHYPHENMIN=1 compound hyphenation
5+
6+
FIRST BUG
7+
---------
8+
9+
Problem
10+
11+
In a compound word, the word parts of two characters are never
12+
hyphenated.
13+
14+
Example
15+
16+
To reproduce the bug, just go to the directory hyphen-2.8.8 and do the
17+
following :
18+
19+
echo "\
20+
UTF-8
21+
LEFTHYPHENMIN 1
22+
RIGHTHYPHENMIN 1
23+
COMPOUNDLEFTHYPHENMIN 1
24+
COMPOUNDRIGHTHYPHENMIN 1
25+
.post1
26+
NEXTLEVEL
27+
e1
28+
a1
29+
" > hyphen.pat
30+
31+
./example hyphen.pat <(echo postea)
32+
33+
The output is post=ea ; but it should be post=e=a.
34+
35+
If you replace postea with posteaque in the command above, you get
36+
post=e=a=que, which is correct. Indeed, the component "eaque" is now
37+
five characters long, so it is hyphenated.
38+
39+
If you replace postea with ea, you get e=a, which is also correct ;
40+
this is because ea is not a compound word.
41+
42+
Solution
43+
44+
In the file hyphen.c, line 966, "if (i - begin > 1)" must be replaced
45+
with "if (i - begin > 0)".
46+
Indeed, the word part is comprised between begin and i inclusively ;
47+
its length is i - begin + 1. So, if you want to hyphenate the words
48+
parts of length 2 and above, you have to check that i - begin + 1 >= 2,
49+
ie i - begin > 0.
50+
51+
SECOND BUG
52+
----------
53+
54+
Problem
55+
56+
In a compound word, the word parts are never hyphenated between their
57+
second to last and their last character.
58+
59+
Example
60+
61+
To reproduce the bug, do the following :
62+
63+
echo "\
64+
UTF-8
65+
LEFTHYPHENMIN 1
66+
RIGHTHYPHENMIN 1
67+
COMPOUNDLEFTHYPHENMIN 1
68+
COMPOUNDRIGHTHYPHENMIN 1
69+
1que.
70+
NEXTLEVEL
71+
e1
72+
" > hyphen.pat
73+
74+
./example hyphen.pat <(echo meaque)
75+
76+
The output is mea=que ; but it should be me=a=que.
77+
78+
Again, if you replace meaque with mea, you get me=a, which is correct,
79+
because mea is not a compound word.
80+
81+
If you replace meaque with eamque, you get e=am=que, as expected ; it
82+
shows that there is no similar bug with the first and the second
83+
character of word parts.
84+
85+
Solution
86+
87+
In the file hyphen.c, line 983, "for (j = 0; j < i - begin - 1; j++)"
88+
must be replaced with "for (j = 0; j < i - begin; j++)".
89+
Indeed, the word part has length i - begin + 1. So there are i - begin
90+
possible places for a hyphen. Thus j must take i - begin different
91+
values, ie go from 0 to i - begin - 1.
92+
---
93+
hyphen.c | 4 ++--
94+
1 file changed, 2 insertions(+), 2 deletions(-)
95+
96+
diff --git a/hyphen.c b/hyphen.c
97+
index 79dc072..4954dbd 100644
98+
--- a/hyphen.c
99+
+++ b/hyphen.c
100+
@@ -963,7 +963,7 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
101+
for (i = 0; i < word_size; i++) rep2[i] = NULL;
102+
for (i = 0; i < word_size; i++) if
103+
(hyphens[i]&1 || (begin > 0 && i + 1 == word_size)) {
104+
- if (i - begin > 1) {
105+
+ if (i - begin > 0) {
106+
int hyph = 0;
107+
prep_word[i + 2] = '\0';
108+
/* non-standard hyphenation at compound boundary (Schiffahrt) */
109+
@@ -980,7 +980,7 @@ int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
110+
hnj_hyphen_hyph_(dict, prep_word + begin + 1, i - begin + 1 + hyph,
111+
hyphens2, &rep2, &pos2, &cut2, clhmin,
112+
crhmin, (begin > 0 ? 0 : lend), (hyphens[i]&1 ? 0 : rend));
113+
- for (j = 0; j < i - begin - 1; j++) {
114+
+ for (j = 0; j < i - begin; j++) {
115+
hyphens[begin + j] = hyphens2[j];
116+
if (rep2[j] && rep && pos && cut) {
117+
if (!*rep && !*pos && !*cut) {

0 commit comments

Comments
 (0)