[gentoo-commits] repo/proj/guru:dev commit in: games-board/rmahjong/, games-board/rmahjong/files/

2020-11-09 Thread Sergey Torokhov
commit: 82abfbd2c267ecf579222b9040140309e09a7dfe
Author: Sergey Torokhov  yandex  ru>
AuthorDate: Mon Nov  9 22:13:01 2020 +
Commit: Sergey Torokhov  yandex  ru>
CommitDate: Mon Nov  9 22:13:01 2020 +
URL:https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=82abfbd2

games-board/rmahjong: update to p20201106 tarball with merged patches

Signed-off-by: Sergey Torokhov  yandex.ru>

 .../files/rmahjong-0.4_fix_python3_compat.patch| 105 
 .../rmahjong/files/rmahjong-0.4_fix_tests.patch| 296 -
 ...201013.ebuild => rmahjong-0.4_p20201106.ebuild} |   9 +-
 3 files changed, 2 insertions(+), 408 deletions(-)

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
deleted file mode 100644
index 0fd0de1e..
--- a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-diff --git a/client/client.py b/client/client.py
 a/client/client.py
-+++ b/client/client.py
-@@ -138,10 +138,10 @@ class Mahjong:
- 
-   def init_player_boxes(self, names, player_winds, score):
-   self.player_boxes = [
--  PlayerBox((50, 700), names[0], player_winds[0], 
int(score[0]), direction_up, (0,-80)),
--  PlayerBox((954, 50), names[1], player_winds[1], 
int(score[1]), direction_left, (-210, 0)),
--  PlayerBox((700, 0), names[2], player_winds[2], 
int(score[2]), direction_up, (0,80)),
--  PlayerBox((0, 50), names[3], player_winds[3], 
int(score[3]), direction_right, (80,0)) ]
-+  PlayerBox((50, 700), names[0], player_winds[0], 
int(float(score[0])), direction_up, (0,-80)),
-+  PlayerBox((954, 50), names[1], player_winds[1], 
int(float(score[1])), direction_left, (-210, 0)),
-+  PlayerBox((700, 0), names[2], player_winds[2], 
int(float(score[2])), direction_up, (0,80)),
-+  PlayerBox((0, 50), names[3], player_winds[3], 
int(float(score[3])), direction_right, (80,0)) ]
-   for widget in self.player_boxes:
-   self.gui.add_widget(widget)
- 
-diff --git a/client/states.py b/client/states.py
 a/client/states.py
-+++ b/client/states.py
-@@ -555,8 +555,8 @@ class ScoreState(RoundPreparingState):
-   results = []
-   for wind in winds:
-   name = (self.mahjong.get_player_name(wind))
--  score = (int(self.message[wind + "_score"]))
--  payment = (int(self.message[wind + "_payment"]))
-+  score = (int(float(self.message[wind + "_score"])))
-+  payment = (int(float(self.message[wind + "_payment"])))
-   results.append((name, score, payment))
-   results.sort(key = lambda r: r[1], reverse = True)
-   return results
-diff --git a/client/tilepainter.py b/client/tilepainter.py
 a/client/tilepainter.py
-+++ b/client/tilepainter.py
-@@ -89,7 +89,7 @@ class TilePainter:
-   img = self.tile_images[name]
-   w = img.get_width()
-   h = img.get_height()
--  screen.blit(pygame.transform.smoothscale(img, (w/4, 
h/4)), position)
-+  screen.blit(pygame.transform.smoothscale(img, (w//4, 
h//4)), position)
- 
-   def draw_tile_list(self, screen, position, tile_names, space = 0):
-   for i, tile_name in enumerate(tile_names):
-diff --git a/server/botengine.py b/server/botengine.py
-index 03623f9..b128135 100644
 a/server/botengine.py
-+++ b/server/botengine.py
-@@ -71,7 +71,7 @@ class BotEngine():
- 
-   def get_tiles(self, blocking = False):
-   if self._is_next_line() or blocking:
--  return map(Tile, (self._read_line().strip().split()))
-+  return [*map(Tile, (self._read_line().strip().split()))]
-   else:
-   return None
- 
-diff --git a/server/eval.py b/server/eval.py
-index 042ee54..dc7e463 100644
 a/server/eval.py
-+++ b/server/eval.py
-@@ -19,6 +19,7 @@ from tile import Pon, Chi
- from tile import red_dragon, white_dragon, green_dragon, dragons
- from tile import bamboos, chars, pins, all_tiles, honors
- from copy import copy
-+import functools
- 
- def is_hand_open(sets):
-   for set in sets:
-@@ -97,14 +97,14 @@
-   
-   if wintype == "Ron":
-   if player_wind.name == "WE":
--  return (name, round_to_base(score / 2 * 3, 100))
-+  return (name, round_to_base(score // 2 * 3, 100))
-   else:
-   return (name, score)
-   else:
-   if player_wind.name == "WE":
--  return (name, (round_to_base(score / 2, 100), 0))
-+  return 

[gentoo-commits] repo/proj/guru:dev commit in: games-board/rmahjong/, games-board/rmahjong/files/

2020-10-26 Thread Sergey Torokhov
commit: 3a392ae4913e38bd7631181fff65f8711ae7396e
Author: Sergey Torokhov  yandex  ru>
AuthorDate: Tue Oct 27 04:25:27 2020 +
Commit: Sergey Torokhov  yandex  ru>
CommitDate: Tue Oct 27 04:25:27 2020 +
URL:https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3a392ae4

games-board/rmahjong: Fix tests ResourceWarnings, remove unittest2 DEPEND

The inittest2 dependence is unneccessary as python3 internal unittest is used.

Update patches to fix passing float into int("") in other way.
Update test.py patch to fix numerous 'ResourceWarning's.

Signed-off-by: Sergey Torokhov  yandex.ru>

 .../files/rmahjong-0.4_fix_python3_compat.patch| 50 --
 .../rmahjong/files/rmahjong-0.4_fix_tests.patch| 14 ++
 games-board/rmahjong/rmahjong-0.4_p20201013.ebuild |  5 +--
 3 files changed, 34 insertions(+), 35 deletions(-)

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
index d6ad5893..62ec68e7 100644
--- a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
+++ b/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch
@@ -1,35 +1,3 @@
-diff --git a/client/client.py b/client/client.py
 a/client/client.py
-+++ b/client/client.py
-@@ -138,10 +138,10 @@ class Mahjong:
- 
-   def init_player_boxes(self, names, player_winds, score):
-   self.player_boxes = [
--  PlayerBox((50, 700), names[0], player_winds[0], 
int(score[0]), direction_up, (0,-80)),
--  PlayerBox((954, 50), names[1], player_winds[1], 
int(score[1]), direction_left, (-210, 0)),
--  PlayerBox((700, 0), names[2], player_winds[2], 
int(score[2]), direction_up, (0,80)),
--  PlayerBox((0, 50), names[3], player_winds[3], 
int(score[3]), direction_right, (80,0)) ]
-+  PlayerBox((50, 700), names[0], player_winds[0], 
int(float(score[0])), direction_up, (0,-80)),
-+  PlayerBox((954, 50), names[1], player_winds[1], 
int(float(score[1])), direction_left, (-210, 0)),
-+  PlayerBox((700, 0), names[2], player_winds[2], 
int(float(score[2])), direction_up, (0,80)),
-+  PlayerBox((0, 50), names[3], player_winds[3], 
int(float(score[3])), direction_right, (80,0)) ]
-   for widget in self.player_boxes:
-   self.gui.add_widget(widget)
- 
-diff --git a/client/states.py b/client/states.py
 a/client/states.py
-+++ b/client/states.py
-@@ -555,8 +555,8 @@ class ScoreState(RoundPreparingState):
-   results = []
-   for wind in winds:
-   name = (self.mahjong.get_player_name(wind))
--  score = (int(self.message[wind + "_score"]))
--  payment = (int(self.message[wind + "_payment"]))
-+  score = (int(float(self.message[wind + "_score"])))
-+  payment = (int(float(self.message[wind + "_payment"])))
-   results.append((name, score, payment))
-   results.sort(key = lambda r: r[1], reverse = True)
-   return results
 diff --git a/client/tilepainter.py b/client/tilepainter.py
 --- a/client/tilepainter.py
 +++ b/client/tilepainter.py
@@ -67,6 +35,24 @@ index 042ee54..dc7e463 100644
  
  def is_hand_open(sets):
for set in sets:
+@@ -97,14 +97,14 @@
+   
+   if wintype == "Ron":
+   if player_wind.name == "WE":
+-  return (name, round_to_base(score / 2 * 3, 100))
++  return (name, round_to_base(score // 2 * 3, 100))
+   else:
+   return (name, score)
+   else:
+   if player_wind.name == "WE":
+-  return (name, (round_to_base(score / 2, 100), 0))
++  return (name, (round_to_base(score // 2, 100), 0))
+   else:
+-  return (name, (round_to_base(score / 4, 100), 
round_to_base(score / 2, 100)))
++  return (name, (round_to_base(score // 4, 100), 
round_to_base(score // 2, 100)))
+ 
+ def quick_pons_and_kans(hand):
+   d = {}
 @@ -274,7 +275,7 @@ def eval_sets(pair, sets, round_wind, player_wind, 
last_tile, wintype):
# Other hands
for name, fn in score_functions:

diff --git a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch 
b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
index 7926e714..93b671db 100644
--- a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
+++ b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch
@@ -1,3 +1,17 @@
+diff a/server/botengine.py b/server/botengine.py
+--- a/server/botengine.py
 b/server/botengine.py
+@@ -53,7 +53,10 @@
+ 
+   def shutdown(self):
+   self.thread.thread_quit = True
++  self.process.stdin.close()
++