Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.8 #650

Merged
merged 10 commits into from
Jul 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v2

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get update
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.12)
project(Plasma)

set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -63,9 +63,8 @@ set_package_properties(OpenSSL PROPERTIES
TYPE REQUIRED
)

set(Python_ADDITIONAL_VERSIONS 2.7)
find_package(PythonLibs REQUIRED)
set_package_properties(PythonLibs PROPERTIES
find_package(Python3 3.8 REQUIRED Interpreter Development)
set_package_properties(Python3 PROPERTIES
URL "http://www.python.org"
DESCRIPTION "Python Scripting language C bindings"
TYPE REQUIRED
Expand Down Expand Up @@ -317,6 +316,7 @@ endif(MSVC)
#TODO: Make the OpenSSL includes less promiscuous so this isn't needed
include_directories(${OPENSSL_INCLUDE_DIR})

add_subdirectory(Scripts)
add_subdirectory(Sources/Plasma)
add_subdirectory(Sources/Tools)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Plasma currently requires the following third-party libraries:

- nVidia PhysX 2.6.4 - https://web.archive.org/web/20170501130625/http://developer.download.nvidia.com/PhysX/2.6.4/PhysX_2.6.4_SDK_Core.exe
- Microsoft DirectX SDK - https://www.microsoft.com/en-us/download/details.aspx?id=6812
- Python 2.7 - http://www.python.org/download/releases/2.7/
- Python 3.8 (or higher) - https://www.python.org/downloads/
- libOgg and libVorbis - http://www.xiph.org/downloads/
- OpenSSL - http://www.slproweb.com/products/Win32OpenSSL.html
- OpenAL Soft - https://openal-soft.org/
Expand Down
55 changes: 55 additions & 0 deletions Scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
add_custom_target(Scripts ALL
COMMENT "Copying engine scripts..."

# Copy core engine files
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/dat" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dat"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/Python" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/python"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/SDL" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SDL"
)

# These Python stdlib modules should be EXCLUDED from the copy due to either practical or
# security concerns.
set(Scripts_BLACKLIST
^__pycache__
^asyncio
^ctypes
^curses
^distutils
^dist-packages
^email
^ensurepip
^http
# contains a module-level SystemExit
^idlelib
^lib2to3
^msilib
# Windows turd
^site-packages
Hoikas marked this conversation as resolved.
Show resolved Hide resolved
^test
^tkinter
^turtledemo
^unittest
^urllib
^venv
^wsgiref
# annoying browser popup POS
^antigravity.py$
^asynchat.py$
^asyncore.py$
^socket.py$
^socketserver.py$
)

# Hunt down all applicable stdlib modules and copy them over.
file(GLOB_RECURSE Scripts_SYSTEM LIST_DIRECTORIES false RELATIVE "${Python3_STDARCH}" "${Python3_STDARCH}/*.py")
foreach(i ${Scripts_BLACKLIST})
list(FILTER Scripts_SYSTEM EXCLUDE REGEX ${i})
endforeach()

add_custom_target(ScriptsSystem
COMMENT "Copying system scripts...")
foreach(i ${Scripts_SYSTEM})
add_custom_command(TARGET ScriptsSystem POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${Python3_STDARCH}/${i}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Python/system/${i}"
)
endforeach()
2 changes: 1 addition & 1 deletion Scripts/Python/Ahnonay.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def OnServerInitComplete(self):
###########################
def OnPageLoad(self,what,who):
global spherePages
PtDebugPrint(u"Ahnonay.OnPageLoad(): what={} who={}".format(what, who), level=kDebugDumpLevel)
PtDebugPrint("Ahnonay.OnPageLoad(): what={} who={}".format(what, who), level=kDebugDumpLevel)

if what == kLoaded:
if who in spherePages:
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Python/ahnyQuabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def OnServerInitComplete(self):
# On quab spawning...
# We will load the avatar clones manually if we are the first one in.
# We will obtain the ptCritterBrains in an OnAIMsg callback.
for i in xrange(self.quabs):
for i in range(self.quabs):
PtLoadAvatarModel(kQuabAvatarName, qSpawns[i].getKey(), "Quab %i" % i)

def OnAIMsg(self, brain, msgType, userStr, args):
Expand Down
12 changes: 6 additions & 6 deletions Scripts/Python/grtzMarkerScopeGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def OnNotify(self, state, id, events):
def OnServerInitComplete(self):
numGames = len(grtzMarkerGames.mgs)
self._scores = [-1] * numGames
for i in xrange(numGames):
for i in range(numGames):
ptGameScore.findPlayerScores(kGameScore.format(i), self.key)
self._scopes = (aScope1Act.id, aScope2Act.id, aScope3Act.id, aScope4Act.id)

Expand Down Expand Up @@ -323,7 +323,7 @@ def _StopCGZM(self, win):
def _UpdateGUI(self, mission=-1, quitting=False, score=None, star=None):
# If mission is -1, this is a total update
if mission == -1:
for i in xrange(len(grtzMarkerGames.mgs)):
for i in range(len(grtzMarkerGames.mgs)):
self._UpdateGUI(i)
return

Expand All @@ -345,19 +345,19 @@ def _UpdateGUI(self, mission=-1, quitting=False, score=None, star=None):
if span == -1:
msg = PtGetLocalizedString("KI.MarkerGame.pendingActionLoading")
else:
msg = u"--:--:--"
msg = "--:--:--"
else:
st = time.gmtime(span)
if st.tm_yday > 1:
# days, hours, minutes, seconds -- you really suck at this
# if you go over a year, you really suck
msg = u"{:02d}:{:02d}:{:02d}:{:02d}".format(st.tm_yday, st.tm_hour, st.tm_min, st.tm_sec)
msg = "{:02d}:{:02d}:{:02d}:{:02d}".format(st.tm_yday, st.tm_hour, st.tm_min, st.tm_sec)
else:
# hours, minutes, seconds
msg = u"{:02d}:{:02d}:{:02d}".format(st.tm_hour, st.tm_min, st.tm_sec)
msg = "{:02d}:{:02d}:{:02d}".format(st.tm_hour, st.tm_min, st.tm_sec)

if star:
msg = u"** {}".format(msg)
msg = "** {}".format(msg)

# Now do the deed
fieldID = (mission * 10) + kMarkerGameFieldStart
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Python/islmEmgrPhase0.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def OnServerInitComplete(self):
ageSDL.setNotify(self.key,variable,0.0)
self.IManageBOOLs(variable, "")

for variable in StateVARs.viewkeys():
for variable in StateVARs.keys():
PtDebugPrint("setting notify on %s" % variable)
ageSDL.setNotify(self.key,variable,0.0)
StateVARs[variable](variable,ageSDL[variable][0])
Expand All @@ -139,7 +139,7 @@ def OnSDLNotify(self,VARname,SDLname,PlayerID,tag):
PtDebugPrint("islmEmgrPhase0.OnSDLNotify : %s is a BOOLEAN Variable" % (VARname))
self.IManageBOOLs(VARname,SDLname)

elif VARname in StateVARs.viewkeys():
elif VARname in StateVARs.keys():
PtDebugPrint("islmEmgrPhas0.OnSDLNotify : %s is a STATE variable" % (VARname))

NewSDLValue = ageSDL[VARname][0]
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Python/islmMemorialImager.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def UpdateMarqueeStrPosition(self, imgMessage):
global kFirstChar
global kLastUpdate
#PtDebugPrint("islmMemorialImager: PtGetDniTime: " + str(PtGetDniTime()) + "kLastUpdate: " + str(kLastUpdate))
movedSince = int(((long(PtGetDniTime()) - long(kLastUpdate)) / kUpdateTime) * kIncAmount)
movedSince = int(((int(PtGetDniTime()) - int(kLastUpdate)) / kUpdateTime) * kIncAmount)
#PtDebugPrint("islmMemorialImager: Distance to move:" , movedSince)
kLastUpdate = PtGetDniTime()
for x in range(4):
Expand Down
Loading