From 29742b69cb8bbbeb32e1195ec8958efb0bdd4946 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 9 Jul 2020 14:01:33 -0700 Subject: [PATCH] Minor bug fixes and build system improvements --- .efrocachemap | 24 +++++----- CHANGELOG.md | 6 ++- assets/src/ba_data/python/ba/_activity.py | 4 +- assets/src/ba_data/python/ba/_coopsession.py | 8 ++-- .../ba_data/python/ba/_freeforallsession.py | 16 +++---- assets/src/ba_data/python/ba/_lobby.py | 4 +- .../ba_data/python/ba/_multiteamsession.py | 4 +- assets/src/ba_data/python/ba/_netutils.py | 4 +- assets/src/ba_data/python/ba/_session.py | 45 ++++++++++--------- .../python/bastd/activity/dualteamscore.py | 2 +- .../python/bastd/activity/multiteamjoin.py | 5 ++- .../python/bastd/actor/controlsguide.py | 6 ++- docs/ba_module.md | 39 ++++++++-------- tools/efrotools/code.py | 6 ++- tools/update_project | 6 +-- 15 files changed, 97 insertions(+), 82 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index ac54aafc..3763543a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4135,16 +4135,16 @@ "assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f", "assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338", "assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/19/bb/f03a6517dc8fdfa02324a3059dbd", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d3/93/3b0a9a32dd7de1373a3f23c0db1c", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/84/c0/59d2d1755a6acd0087892cda1f2f", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1c/c5/dccf038a6357df5f363e81f26f3c", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/85/8d/56a2e40acf5dfa800475875b469e", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9d/66/3c5ac59f38b141f58d0070180ec7", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/fe/c5/f94df676b749a6c26dea2a650893", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/64/bc/8802a039ffc5f6d751afe42c8848", - "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/ff/de/ef57afea5f6185b94e7b655cb6cf", - "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b5/ea/9b7604181d98cafe49cc2b7ceb2e", - "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9e/fb/f81378d8e98f81dc54b097b132db", - "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/82/c9/72c92564a78169edf48a640b5e9a" + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/57/f8/47526bddac42b974f4ce86d13166", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0a/a9/46cb3927b667d67d8dc936b744b6", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/f3/130eb5ddb320f11093ba92bfbe6a", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/53/a6/56310d64b07fb7aa1481e59a4d29", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/cd/6a/1518d0ebde22f06a679edf04002a", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/72/4f/f4d081f47a48ba940603a6825c1f", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d9/1f/436439103f6ede3ec88f46b592a7", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/97/44/68715ff4f2208719f42e174db2e5", + "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/39/87/ce5cf695b6af229875b9c5ff757e", + "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/db/f1/50f277827b1b070dd3b4c5c97553", + "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/20/f3/6fb608d305279d5d8663f6b8cee6", + "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/71/a0/00ae9e235e28b18def6847d69c75" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1a558d..ced1dff9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ +### 1.5.20 (20126) +- The ba.Session.teams and ba.Session.players lists are now ba.Session.sessionteams and ba.Session.sessionplayers. This is to help keep it clear that a Team/Player and a SessionTeam/SessionPlayer are different things now. +- Disconnecting an input-device now immediately removes the player instead of doing so in the next cycle; this prevents possible issues where code would try to access player.inputdevice before the removal happens which would lead to errors. +- Updated mac prefab builds to point at homebrew's python@3.7 package now that 3.8 has been made the default. + ### 1.5.19 (20123) - Cleaned up some bomb logic to avoid weird corner-cases such as land-mine explosions behaving like punches when set off by punches or bombs potentially resulting in multiple explosions when triggered by multiple other bombs simultaneously. Holler if anything explosion-related seems off now. - Reactivated and cleaned up fatal-error message dialogs; they should now show up more consistently and on more platforms when something really bad happens instead of getting a silent crash. - Certain hardware buttons on Android which stopped working in 1.5 should now be working again.. - ### 1.5.18 (20108) - A bit of project cleanup; tools/snippets is now tools/pcommand, etc. - More minor bug fixes and crash/bug-logging improvements. diff --git a/assets/src/ba_data/python/ba/_activity.py b/assets/src/ba_data/python/ba/_activity.py index ae03193d..1eefd4b1 100644 --- a/assets/src/ba_data/python/ba/_activity.py +++ b/assets/src/ba_data/python/ba/_activity.py @@ -494,11 +494,11 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]): self._stats = session.stats # Add session's teams in. - for team in session.teams: + for team in session.sessionteams: self.add_team(team) # Add session's players in. - for player in session.players: + for player in session.sessionplayers: self.add_player(player) self._has_begun = True diff --git a/assets/src/ba_data/python/ba/_coopsession.py b/assets/src/ba_data/python/ba/_coopsession.py index e6c9dcaf..b50365f1 100644 --- a/assets/src/ba_data/python/ba/_coopsession.py +++ b/assets/src/ba_data/python/ba/_coopsession.py @@ -189,7 +189,7 @@ class CoopSession(Session): # If there's *no* players left in the current activity but there *is* # in the session, restart the activity to pull them into the game # (or quit if they're just in the lobby). - if not activity.players and self.players: + if not activity.players and self.sessionplayers: # Special exception for tourney games; don't auto-restart these. if self.tournament_id is not None: @@ -226,7 +226,7 @@ class CoopSession(Session): # Make an exception if there's no players left. Otherwise this # can override the default session end that occurs in that case. - if not self.players: + if not self.sessionplayers: return # This method may get called from the UI context so make sure we @@ -268,7 +268,7 @@ class CoopSession(Session): # If at any point we have no in-game players, quit out of the session # (this can happen if someone leaves in the tutorial for instance). - active_players = [p for p in self.players if p.in_game] + active_players = [p for p in self.sessionplayers if p.in_game] if not active_players: self.end() return @@ -305,7 +305,7 @@ class CoopSession(Session): # Reset stats for the new activity. self.stats.reset() - for player in self.players: + for player in self.sessionplayers: # Skip players that are still choosing a team. if player.in_game: diff --git a/assets/src/ba_data/python/ba/_freeforallsession.py b/assets/src/ba_data/python/ba/_freeforallsession.py index 2f39ba5c..e88457f4 100644 --- a/assets/src/ba_data/python/ba/_freeforallsession.py +++ b/assets/src/ba_data/python/ba/_freeforallsession.py @@ -49,17 +49,17 @@ class FreeForAllSession(MultiTeamSession): This is based on the current number of players. """ point_awards: Dict[int, int] - if len(self.players) == 1: + if len(self.sessionplayers) == 1: point_awards = {} - elif len(self.players) == 2: + elif len(self.sessionplayers) == 2: point_awards = {0: 6} - elif len(self.players) == 3: + elif len(self.sessionplayers) == 3: point_awards = {0: 6, 1: 3} - elif len(self.players) == 4: + elif len(self.sessionplayers) == 4: point_awards = {0: 8, 1: 4, 2: 2} - elif len(self.players) == 5: + elif len(self.sessionplayers) == 5: point_awards = {0: 8, 1: 4, 2: 2} - elif len(self.players) == 6: + elif len(self.sessionplayers) == 6: point_awards = {0: 8, 1: 4, 2: 2} else: point_awards = {0: 8, 1: 4, 2: 2, 3: 1} @@ -80,7 +80,7 @@ class FreeForAllSession(MultiTeamSession): # If there's multiple players and everyone has the same score, # call it a draw. - if len(self.players) > 1 and len(winners) < 2: + if len(self.sessionplayers) > 1 and len(winners) < 2: self.setactivity( _ba.newactivity(DrawScoreScreenActivity, {'results': results})) else: @@ -95,7 +95,7 @@ class FreeForAllSession(MultiTeamSession): team.customdata['score'] += points series_winners = [ - team for team in self.teams + team for team in self.sessionteams if team.customdata['score'] >= self._ffa_series_length ] series_winners.sort(reverse=True, diff --git a/assets/src/ba_data/python/ba/_lobby.py b/assets/src/ba_data/python/ba/_lobby.py index c3564c81..82898aba 100644 --- a/assets/src/ba_data/python/ba/_lobby.py +++ b/assets/src/ba_data/python/ba/_lobby.py @@ -841,7 +841,9 @@ class Lobby: session = _ba.getsession() self._use_team_colors = session.use_team_colors if session.use_teams: - self._sessionteams = [weakref.ref(team) for team in session.teams] + self._sessionteams = [ + weakref.ref(team) for team in session.sessionteams + ] else: self._dummy_teams = SessionTeam() self._sessionteams = [weakref.ref(self._dummy_teams)] diff --git a/assets/src/ba_data/python/ba/_multiteamsession.py b/assets/src/ba_data/python/ba/_multiteamsession.py index 223c3930..ecf962d7 100644 --- a/assets/src/ba_data/python/ba/_multiteamsession.py +++ b/assets/src/ba_data/python/ba/_multiteamsession.py @@ -199,7 +199,7 @@ class MultiTeamSession(Session): if isinstance(activity, TeamSeriesVictoryScoreScreenActivity): self.stats.reset() self._game_number = 0 - for team in self.teams: + for team in self.sessionteams: team.customdata['score'] = 0 # Otherwise just set accum (per-game) scores. @@ -216,7 +216,7 @@ class MultiTeamSession(Session): self._instantiate_next_game() # (Re)register all players and wire stats to our next activity. - for player in self.players: + for player in self.sessionplayers: # ..but only ones who have been placed on a team # (ie: no longer sitting in the lobby). try: diff --git a/assets/src/ba_data/python/ba/_netutils.py b/assets/src/ba_data/python/ba/_netutils.py index 0fd9ed2e..c414d7a4 100644 --- a/assets/src/ba_data/python/ba/_netutils.py +++ b/assets/src/ba_data/python/ba/_netutils.py @@ -158,7 +158,9 @@ class ServerCallThread(threading.Thread): elif isinstance(exc, OSError): if exc.errno == 10051: # Windows unreachable network error. pass - elif exc.errno in [errno.ETIMEDOUT, errno.EHOSTUNREACH]: + elif exc.errno in [ + errno.ETIMEDOUT, errno.EHOSTUNREACH, errno.ENETUNREACH + ]: pass else: do_print = True diff --git a/assets/src/ba_data/python/ba/_session.py b/assets/src/ba_data/python/ba/_session.py index ed79d753..1aea000a 100644 --- a/assets/src/ba_data/python/ba/_session.py +++ b/assets/src/ba_data/python/ba/_session.py @@ -48,21 +48,22 @@ class Session: Attrs: - teams - All the ba.Teams in the Session. Most things should use the team - list in ba.Activity; not this. + sessionteams + All the ba.SessionTeams in the Session. Most things should use the + list of ba.Teams in ba.Activity; not this. - players - All ba.Players in the Session. Most things should use the player - list in ba.Activity; not this. Some players, such as those who have - not yet selected a character, will only appear on this list. + sessionplayers + All ba.SessionPlayers in the Session. Most things should use the + list of ba.Players in ba.Activity; not this. Some players, such as + those who have not yet selected a character, will only be + found on this list. min_players - The minimum number of Players who must be present for the Session + The minimum number of players who must be present for the Session to proceed past the initial joining screen. max_players - The maximum number of Players allowed in the Session. + The maximum number of players allowed in the Session. lobby The ba.Lobby instance where new ba.Players go to select a @@ -98,9 +99,9 @@ class Session: lobby: ba.Lobby max_players: int min_players: int - players: List[ba.SessionPlayer] + sessionplayers: List[ba.SessionPlayer] customdata: dict - teams: List[ba.SessionTeam] + sessionteams: List[ba.SessionTeam] def __init__(self, depsets: Sequence[ba.DependencySet], @@ -166,8 +167,8 @@ class Session: # Should remove this if possible. self.tournament_id: Optional[str] = None - self.teams = [] - self.players = [] + self.sessionteams = [] + self.sessionplayers = [] self.min_players = min_players self.max_players = max_players @@ -195,7 +196,7 @@ class Session: name=GameActivity.get_team_display_string( team_names[i]), color=color) - self.teams.append(team) + self.sessionteams.append(team) self._next_team_id += 1 try: with _ba.Context(self): @@ -226,7 +227,7 @@ class Session: # Limit player counts *unless* we're in a stress test. if _ba.app.stress_test_reset_timer is None: - if len(self.players) >= self.max_players: + if len(self.sessionplayers) >= self.max_players: # Print a rejection message *only* to the client trying to # join (prevents spamming everyone else in the game). @@ -245,7 +246,7 @@ class Session: def on_player_leave(self, sessionplayer: ba.SessionPlayer) -> None: """Called when a previously-accepted ba.SessionPlayer leaves.""" - if sessionplayer not in self.players: + if sessionplayer not in self.sessionplayers: print('ERROR: Session.on_player_leave called' ' for player not in our list.') return @@ -295,7 +296,7 @@ class Session: self._remove_player_team(sessionteam, activity) # Now remove them from the session list. - self.players.remove(sessionplayer) + self.sessionplayers.remove(sessionplayer) def _remove_player_team(self, sessionteam: ba.SessionTeam, activity: Optional[ba.Activity]) -> None: @@ -313,9 +314,9 @@ class Session: # And then from the Session. with _ba.Context(self): - if sessionteam in self.teams: + if sessionteam in self.sessionteams: try: - self.teams.remove(sessionteam) + self.sessionteams.remove(sessionteam) self.on_team_leave(sessionteam) except Exception: print_exception( @@ -535,7 +536,7 @@ class Session: # If they said yes, add the player to the lobby. if result: - self.players.append(sessionplayer) + self.sessionplayers.append(sessionplayer) with _ba.Context(self): try: self.lobby.add_chooser(sessionplayer) @@ -643,7 +644,7 @@ class Session: def _add_chosen_player(self, chooser: ba.Chooser) -> ba.SessionPlayer: from ba._team import SessionTeam sessionplayer = chooser.getplayer() - assert sessionplayer in self.players, ( + assert sessionplayer in self.sessionplayers, ( 'SessionPlayer not found in session ' 'player-list after chooser selection.') @@ -686,7 +687,7 @@ class Session: ) # Add player's team to the Session. - self.teams.append(sessionteam) + self.sessionteams.append(sessionteam) with _ba.Context(self): try: diff --git a/assets/src/ba_data/python/bastd/activity/dualteamscore.py b/assets/src/ba_data/python/bastd/activity/dualteamscore.py index 8831d687..6efa7ea5 100644 --- a/assets/src/ba_data/python/bastd/activity/dualteamscore.py +++ b/assets/src/ba_data/python/bastd/activity/dualteamscore.py @@ -75,7 +75,7 @@ class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity): scale=0.25, color=(0.5, 0.5, 0.5, 1.0), jitter=3.0).autoretain() - for team in self.session.teams: + for team in self.session.sessionteams: ba.timer( i * 0.15 + 0.15, ba.WeakCall(self._show_team_name, vval - i * height, team, diff --git a/assets/src/ba_data/python/bastd/activity/multiteamjoin.py b/assets/src/ba_data/python/bastd/activity/multiteamjoin.py index 56e344ae..38fe9a7b 100644 --- a/assets/src/ba_data/python/bastd/activity/multiteamjoin.py +++ b/assets/src/ba_data/python/bastd/activity/multiteamjoin.py @@ -66,9 +66,10 @@ class MultiTeamJoinActivity(JoinActivity): # In teams mode, show our two team names. # FIXME: Lobby should handle this. if isinstance(ba.getsession(), DualTeamSession): - team_names = [team.name for team in ba.getsession().teams] + team_names = [team.name for team in ba.getsession().sessionteams] team_colors = [ - tuple(team.color) + (0.5, ) for team in ba.getsession().teams + tuple(team.color) + (0.5, ) + for team in ba.getsession().sessionteams ] if len(team_names) == 2: for i in range(2): diff --git a/assets/src/ba_data/python/bastd/actor/controlsguide.py b/assets/src/ba_data/python/bastd/actor/controlsguide.py index bfb33de6..374bb7ef 100644 --- a/assets/src/ba_data/python/bastd/actor/controlsguide.py +++ b/assets/src/ba_data/python/bastd/actor/controlsguide.py @@ -271,7 +271,9 @@ class ControlsGuide(ba.Actor): # We look at the session's players; not the activity's. # We want to get ones who are still in the process of # selecting a character, etc. - input_devices = [p.inputdevice for p in ba.getsession().players] + input_devices = [ + p.inputdevice for p in ba.getsession().sessionplayers + ] input_devices = [ i for i in input_devices if i and i is not touchscreen ] @@ -323,7 +325,7 @@ class ControlsGuide(ba.Actor): # We look at the session's players; not the activity's - we want to # get ones who are still in the process of selecting a character, etc. - input_devices = [p.inputdevice for p in ba.getsession().players] + input_devices = [p.inputdevice for p in ba.getsession().sessionplayers] input_devices = [i for i in input_devices if i] # If there's no players with input devices yet, try to default to diff --git a/docs/ba_module.md b/docs/ba_module.md index e8f344b3..8953ba8c 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-07-08 for Ballistica version 1.5.19 build 20119

+

last updated on 2020-07-09 for Ballistica version 1.5.20 build 20128

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


@@ -1734,7 +1734,7 @@ and it should begin its actual game logic.

high score lists.

Attributes Inherited:

-
allow_mid_activity_joins, customdata, lobby, max_players, min_players, players, teams, use_team_colors, use_teams
+
allow_mid_activity_joins, customdata, lobby, max_players, min_players, sessionplayers, sessionteams, use_team_colors, use_teams

Attributes Defined Here:

campaign, sessionglobalsnode
@@ -2092,7 +2092,7 @@ its time with lingering corpses, sound effects, etc.

Attributes Inherited:

-
allow_mid_activity_joins, customdata, lobby, max_players, min_players, players, teams, use_team_colors, use_teams
+
allow_mid_activity_joins, customdata, lobby, max_players, min_players, sessionplayers, sessionteams, use_team_colors, use_teams

Attributes Defined Here:

sessionglobalsnode

@@ -2219,7 +2219,7 @@ its time with lingering corpses, sound effects, etc.

<all methods inherited from ba.Team>


ba.Existable

-

Inherits from: typing_extensions.Protocol

+

Inherits from: typing.Protocol, typing.Generic

A Protocol for objects supporting an exists() method.

Category: Protocols @@ -2273,7 +2273,7 @@ its time with lingering corpses, sound effects, etc.

Attributes Inherited:

-
allow_mid_activity_joins, customdata, lobby, max_players, min_players, players, teams, use_team_colors, use_teams
+
allow_mid_activity_joins, customdata, lobby, max_players, min_players, sessionplayers, sessionteams, use_team_colors, use_teams

Attributes Defined Here:

sessionglobalsnode

@@ -3687,7 +3687,7 @@ Use ba.getmodel() to instantiate one.

Attributes Inherited:

-
allow_mid_activity_joins, customdata, lobby, max_players, min_players, players, teams, use_team_colors, use_teams
+
allow_mid_activity_joins, customdata, lobby, max_players, min_players, sessionplayers, sessionteams, use_team_colors, use_teams

Attributes Defined Here:

sessionglobalsnode

@@ -4659,7 +4659,7 @@ Pass 0 or a negative number for no ban time.

maintaining state between them (players, teams, score tallies, etc).

Attributes:

-
allow_mid_activity_joins, customdata, lobby, max_players, min_players, players, sessionglobalsnode, teams, use_team_colors, use_teams
+
allow_mid_activity_joins, customdata, lobby, max_players, min_players, sessionglobalsnode, sessionplayers, sessionteams, use_team_colors, use_teams

allow_mid_activity_joins

bool

@@ -4683,31 +4683,32 @@ any such selection.

max_players

int

-

The maximum number of Players allowed in the Session.

+

The maximum number of players allowed in the Session.

min_players

int

-

The minimum number of Players who must be present for the Session +

The minimum number of players who must be present for the Session to proceed past the initial joining screen.

-
-

players

-

List[ba.SessionPlayer]

-

All ba.Players in the Session. Most things should use the player -list in ba.Activity; not this. Some players, such as those who have -not yet selected a character, will only appear on this list.

-

sessionglobalsnode

ba.Node

The sessionglobals ba.Node for the session.

-

teams

+

sessionplayers

+

List[ba.SessionPlayer]

+

All ba.SessionPlayers in the Session. Most things should use the +list of ba.Players in ba.Activity; not this. Some players, such as +those who have not yet selected a character, will only be +found on this list.

+ +
+

sessionteams

List[ba.SessionTeam]

-

All the ba.Teams in the Session. Most things should use the team -list in ba.Activity; not this.

+

All the ba.SessionTeams in the Session. Most things should use the +list of ba.Teams in ba.Activity; not this.

use_team_colors

diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index ea3b4d53..28dfd52b 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -149,7 +149,8 @@ def cpplint(projroot: Path, full: bool) -> None: codelines[unknownlintline] = ' elif False:' def lint_file(filename: str) -> None: - result = subprocess.call(['cpplint', '--root=src', filename], env=env) + result = subprocess.call( + ['python3.7', '-m', 'cpplint', '--root=src', filename], env=env) if result != 0: raise CleanError( f'{Clr.RED}Cpplint failed for {filename}.{Clr.RST}') @@ -213,7 +214,8 @@ def formatscripts(projroot: Path, full: bool) -> None: def format_file(filename: str) -> None: start_time = time.time() - result = subprocess.call(['yapf', '--in-place', filename]) + result = subprocess.call( + ['python3.7', '-m', 'yapf', '--in-place', filename]) if result != 0: raise Exception(f'Formatting failed for {filename}') duration = time.time() - start_time diff --git a/tools/update_project b/tools/update_project index 5f5f49b2..719c01f5 100755 --- a/tools/update_project +++ b/tools/update_project @@ -586,11 +586,11 @@ class App: with open(fname) as infile: lines = infile.read().splitlines() - auto_start = lines.index(' #AUTOGENERATED_BEGIN (this section' + auto_start = lines.index(' #AUTOGENERATED_BEGIN (this section' ' is managed by the "update_project" tool)') - auto_end = lines.index(' #AUTOGENERATED_END') + auto_end = lines.index(' #AUTOGENERATED_END') our_lines = [ - ' ${BA_SRC_ROOT}/ballistica' + f + ' ${BA_SRC_ROOT}/ballistica' + f for f in sorted(self._source_files + self._header_files) if not f.endswith('.mm') and not f.endswith('.m') ]