Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: games-board/rmahjong/files/, games-board/rmahjong/
Date: Tue, 27 Oct 2020 18:27:50
Message-Id: 1603772727.3a392ae4913e38bd7631181fff65f8711ae7396e.andrewammerlaan@gentoo
1 commit: 3a392ae4913e38bd7631181fff65f8711ae7396e
2 Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru>
3 AuthorDate: Tue Oct 27 04:25:27 2020 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
5 CommitDate: Tue Oct 27 04:25:27 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3a392ae4
7
8 games-board/rmahjong: Fix tests ResourceWarnings, remove unittest2 DEPEND
9
10 The inittest2 dependence is unneccessary as python3 internal unittest is used.
11
12 Update patches to fix passing float into int("") in other way.
13 Update test.py patch to fix numerous 'ResourceWarning's.
14
15 Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru>
16
17 .../files/rmahjong-0.4_fix_python3_compat.patch | 50 ++++++++--------------
18 .../rmahjong/files/rmahjong-0.4_fix_tests.patch | 14 ++++++
19 games-board/rmahjong/rmahjong-0.4_p20201013.ebuild | 5 +--
20 3 files changed, 34 insertions(+), 35 deletions(-)
21
22 diff --git a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch b/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
23 index d6ad5893..62ec68e7 100644
24 --- a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
25 +++ b/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
26 @@ -1,35 +1,3 @@
27 -diff --git a/client/client.py b/client/client.py
28 ---- a/client/client.py
29 -+++ b/client/client.py
30 -@@ -138,10 +138,10 @@ class Mahjong:
31 -
32 - def init_player_boxes(self, names, player_winds, score):
33 - self.player_boxes = [
34 -- PlayerBox((50, 700), names[0], player_winds[0], int(score[0]), direction_up, (0,-80)),
35 -- PlayerBox((954, 50), names[1], player_winds[1], int(score[1]), direction_left, (-210, 0)),
36 -- PlayerBox((700, 0), names[2], player_winds[2], int(score[2]), direction_up, (0,80)),
37 -- PlayerBox((0, 50), names[3], player_winds[3], int(score[3]), direction_right, (80,0)) ]
38 -+ PlayerBox((50, 700), names[0], player_winds[0], int(float(score[0])), direction_up, (0,-80)),
39 -+ PlayerBox((954, 50), names[1], player_winds[1], int(float(score[1])), direction_left, (-210, 0)),
40 -+ PlayerBox((700, 0), names[2], player_winds[2], int(float(score[2])), direction_up, (0,80)),
41 -+ PlayerBox((0, 50), names[3], player_winds[3], int(float(score[3])), direction_right, (80,0)) ]
42 - for widget in self.player_boxes:
43 - self.gui.add_widget(widget)
44 -
45 -diff --git a/client/states.py b/client/states.py
46 ---- a/client/states.py
47 -+++ b/client/states.py
48 -@@ -555,8 +555,8 @@ class ScoreState(RoundPreparingState):
49 - results = []
50 - for wind in winds:
51 - name = (self.mahjong.get_player_name(wind))
52 -- score = (int(self.message[wind + "_score"]))
53 -- payment = (int(self.message[wind + "_payment"]))
54 -+ score = (int(float(self.message[wind + "_score"])))
55 -+ payment = (int(float(self.message[wind + "_payment"])))
56 - results.append((name, score, payment))
57 - results.sort(key = lambda r: r[1], reverse = True)
58 - return results
59 diff --git a/client/tilepainter.py b/client/tilepainter.py
60 --- a/client/tilepainter.py
61 +++ b/client/tilepainter.py
62 @@ -67,6 +35,24 @@ index 042ee54..dc7e463 100644
63
64 def is_hand_open(sets):
65 for set in sets:
66 +@@ -97,14 +97,14 @@
67 +
68 + if wintype == "Ron":
69 + if player_wind.name == "WE":
70 +- return (name, round_to_base(score / 2 * 3, 100))
71 ++ return (name, round_to_base(score // 2 * 3, 100))
72 + else:
73 + return (name, score)
74 + else:
75 + if player_wind.name == "WE":
76 +- return (name, (round_to_base(score / 2, 100), 0))
77 ++ return (name, (round_to_base(score // 2, 100), 0))
78 + else:
79 +- return (name, (round_to_base(score / 4, 100), round_to_base(score / 2, 100)))
80 ++ return (name, (round_to_base(score // 4, 100), round_to_base(score // 2, 100)))
81 +
82 + def quick_pons_and_kans(hand):
83 + d = {}
84 @@ -274,7 +275,7 @@ def eval_sets(pair, sets, round_wind, player_wind, last_tile, wintype):
85 # Other hands
86 for name, fn in score_functions:
87
88 diff --git a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
89 index 7926e714..93b671db 100644
90 --- a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
91 +++ b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
92 @@ -1,3 +1,17 @@
93 +diff a/server/botengine.py b/server/botengine.py
94 +--- a/server/botengine.py
95 ++++ b/server/botengine.py
96 +@@ -53,7 +53,10 @@
97 +
98 + def shutdown(self):
99 + self.thread.thread_quit = True
100 ++ self.process.stdin.close()
101 ++ self.process.stdout.close()
102 + self.process.terminate()
103 ++ self.process.wait()
104 + #self._write("QUIT\n")
105 + #self.join()
106 +
107 diff --git a/server/test.py b/server/test.py
108 --- a/server/test.py
109 +++ b/server/test.py
110
111 diff --git a/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild b/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild
112 index 28f4c28e..fff2446a 100644
113 --- a/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild
114 +++ b/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild
115 @@ -38,7 +38,6 @@ RDEPEND="
116 dev-python/pyopengl[${PYTHON_MULTI_USEDEP}]
117 ')
118 "
119 -DEPEND="test? ( dev-python/unittest2 )"
120
121 PATCHES=(
122 "${FILESDIR}/${PN}-0.4_fix_python3_compat.patch"
123 @@ -62,7 +61,7 @@ src_compile() {
124 }
125
126 src_test() {
127 - cd "${S}/server/" && python3 test.py
128 + cd "${S}/server/" && python3 test.py -v
129 }
130
131 src_install() {
132 @@ -79,5 +78,5 @@ src_install() {
133
134 dobin "rmahjong"
135 doicon -s 48 "${DISTDIR}/kmahjongg_${PN}.png"
136 - make_desktop_entry "${PN}" "RMahjong" "kmahjongg_${PN}.png" "Game;BoardGame;" || die "Failed making desktop entry!"
137 + make_desktop_entry "${PN}" "RMahjong" "kmahjongg_${PN}" "Game;BoardGame;" || die "Failed making desktop entry!"
138 }