diff --git a/CMakeLists.txt b/CMakeLists.txt index 14fedc737..335b3e2df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -526,7 +526,7 @@ if(${BUILD_PYTHON}) "${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp" COMMAND "${Python3_EXECUTABLE}" ${SETUP_PY} build_ext -L ${CMAKE_CURRENT_BINARY_DIR} -b ${CMAKE_CURRENT_BINARY_DIR}/python -t${CMAKE_CURRENT_BINARY_DIR}/python && - "${Python3_EXECUTABLE}" ${SETUP_PY} build + "${Python3_EXECUTABLE}" ${SETUP_PY} build_py DEPENDS ${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses COMMENT "Building Python wrappers" diff --git a/debian/control b/debian/control index 0b48a0515..86f0efa90 100644 --- a/debian/control +++ b/debian/control @@ -98,6 +98,7 @@ Package: python3-notcurses Section: python Architecture: any Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends} +Provides: ${python3:Provides} Description: Python wrappers for notcurses (Python 3) Python wrappers for the notcurses TUI library. . diff --git a/debian/python3-notcurses.prerm b/debian/python3-notcurses.prerm index ecb9d1dd7..e31f4b10f 100755 --- a/debian/python3-notcurses.prerm +++ b/debian/python3-notcurses.prerm @@ -3,7 +3,7 @@ set -e # --------------------- copied from dh-python 4.20191017 --------- if which py3clean >/dev/null 2>&1; then - py3clean -p python3-notcurses.interface + py3clean -p python3-notcurses.interface 2> /dev/null || true else dpkg -L python3-notcurses.interface | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)' find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir diff --git a/debian/rules b/debian/rules index a38f0856f..911e4e2c9 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ override_dh_auto_configure: override_dh_auto_build: dh_auto_build cd python && python3 setup.py build_ext -L../obj-$(DEB_HOST_MULTIARCH) -I../include - cd python && python3 setup.py build + cd python && python3 setup.py build_py override_dh_auto_install: dh_auto_install -B $(BUILDDIR) diff --git a/python/src/notcurses.py b/python/src/notcurses.py index baf99e4f7..59c8c7ea0 100644 --- a/python/src/notcurses.py +++ b/python/src/notcurses.py @@ -1,5 +1,4 @@ import sys -import locale import _cffi_backend from _notcurses import lib, ffi @@ -99,27 +98,3 @@ class Ncdirect: def setBg(self, rgb): checkRGB(rgb) lib.ncdirect_bg(self.nc, rgb) - -if __name__ == '__main__': - locale.setlocale(locale.LC_ALL, "") - nc = Notcurses() - c = Cell(nc.stdplane()) - c.setBgRGB(0x80, 0xc0, 0x80) - nc.stdplane().setBaseCell(c) - dims = nc.stdplane().getDimensions() - r = 0x80 - g = 0x80 - b = 0x80 - for y in range(dims[0]): - for x in range(dims[1]): - nc.stdplane().setFgRGB(r, g, b) - nc.stdplane().setBgRGB(b, r, g) - nc.stdplane().putSimpleYX(y, x, b'X') - b = b + 2 - if b == 256: - b = 0 - g = g + 2 - if g == 256: - g = 0 - r = r + 2 - nc.render() diff --git a/python/src/notcurses/__main__.py b/python/src/notcurses/__main__.py new file mode 100644 index 000000000..07cbfe2a0 --- /dev/null +++ b/python/src/notcurses/__main__.py @@ -0,0 +1,28 @@ +import sys +import locale +import notcurses +import _cffi_backend +from _notcurses import lib, ffi + +locale.setlocale(locale.LC_ALL, "") +nc = notcurses.Notcurses() +c = Cell(nc.stdplane()) +c.setBgRGB(0x80, 0xc0, 0x80) +nc.stdplane().setBaseCell(c) +dims = nc.stdplane().getDimensions() +r = 0x80 +g = 0x80 +b = 0x80 +for y in range(dims[0]): + for x in range(dims[1]): + nc.stdplane().setFgRGB(r, g, b) + nc.stdplane().setBgRGB(b, r, g) + nc.stdplane().putSimpleYX(y, x, b'X') + b = b + 2 + if b == 256: + b = 0 + g = g + 2 + if g == 256: + g = 0 + r = r + 2 +nc.render()