Debian/python: make module runnable #335

pull/344/head
nick black 5 years ago
parent acbff55994
commit b8adfe1a39

@ -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"

1
debian/control vendored

@ -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.
.

@ -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

2
debian/rules vendored

@ -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)

@ -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()

@ -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()
Loading…
Cancel
Save