mirror of https://github.com/mgba-emu/mgba.git
Python: Python 3 support
This commit is contained in:
parent
0723646354
commit
33295b1297
|
@ -1,3 +1,5 @@
|
|||
find_program(PYTHON python)
|
||||
|
||||
set(PY_INCLUDE_DIRS -I${CMAKE_SOURCE_DIR}/src)
|
||||
get_property(INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
get_property(COMPILE_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
||||
|
@ -15,13 +17,13 @@ add_custom_command(OUTPUT _builder.h
|
|||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.h)
|
||||
add_custom_target(_builder.h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_builder.h)
|
||||
|
||||
add_custom_target(${BINARY_NAME}-pylib COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py ${PY_COMPILE_DEFS} ${PY_INCLUDE_DIRS}
|
||||
add_custom_target(${BINARY_NAME}-pylib COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py ${PY_COMPILE_DEFS} ${PY_INCLUDE_DIRS}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/_builder.py
|
||||
DEPENDS _builder.h)
|
||||
|
||||
add_custom_command(OUTPUT ${BINARY_NAME}/__init__.py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
|
||||
COMMAND python ${CMAKE_CURRENT_BINARY_DIR}/setup.py build
|
||||
COMMAND ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py build
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setup.py
|
||||
DEPENDS ${BINARY_NAME}-pylib)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
|
||||
class _ARMRegisters:
|
||||
def __init__(self, cpu):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
|
||||
def find(path):
|
||||
core = lib.mCoreFind(path.encode('UTF-8'))
|
||||
|
@ -31,7 +31,7 @@ def loadVF(vf):
|
|||
|
||||
class Core:
|
||||
def __init__(self, native):
|
||||
self._core = ffi.gc(native, self._deinit)
|
||||
self._core = ffi.gc(native, native.deinit)
|
||||
success = bool(self._core.init(self._core))
|
||||
if not success:
|
||||
raise RuntimeError("Failed to initialize core")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
|
||||
class GB:
|
||||
def __init__(self, native):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
|
||||
class GBA:
|
||||
def __init__(self, native):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
from . import png
|
||||
|
||||
class Image:
|
||||
|
@ -23,4 +23,4 @@ class Image:
|
|||
success = p.writeHeader(self)
|
||||
success = success and p.writePixels(self)
|
||||
p.writeClose()
|
||||
return success
|
||||
return success
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
|
||||
class LR35902Core:
|
||||
def __init__(self, native):
|
||||
|
@ -52,4 +52,4 @@ class LR35902Core:
|
|||
if key == 'sp':
|
||||
self._native.sp = value
|
||||
else:
|
||||
self.__dict__[key] = value
|
||||
self.__dict__[key] = value
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
from . import vfs
|
||||
|
||||
class PNG:
|
||||
|
@ -21,4 +21,4 @@ class PNG:
|
|||
def writeClose(self):
|
||||
lib.PNGWriteClose(self._png, self._info)
|
||||
del self._png
|
||||
del self._info
|
||||
del self._info
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from _pylib import ffi, lib
|
||||
from ._pylib import ffi, lib
|
||||
import mmap
|
||||
import os
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import re
|
|||
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 2",
|
||||
# "Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)"
|
||||
]
|
||||
|
||||
|
@ -13,6 +13,8 @@ setup(name="${BINARY_NAME}",
|
|||
author_email="jeffrey@endrift.com",
|
||||
url="http://github.com/mgba-emu/mgba/",
|
||||
packages=["mgba"],
|
||||
setup_requires=['cffi>=1.6'],
|
||||
install_requires=['cffi>=1.6'],
|
||||
license="MPL 2.0",
|
||||
classifiers=classifiers
|
||||
)
|
Loading…
Reference in New Issue