Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci
on:
push:
pull_request:
workflow_dispatch:
jobs:
ci:
strategy:
fail-fast: false # https://github.com/actions/runner-images#available-images
matrix: # https://www.lua.org/versions.html
os: [macos-26, macos-26-intel, ubuntu-26.04, ubuntu-26.04-arm]
runs-on: ${{ matrix.os }}
steps:
- run: echo "${{ runner.os }} on ${{ runner.arch }}"
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y luarocks
- if: runner.os == 'macOS'
run: brew install luarocks
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: 3.x
pip-install: --editable .
# Dependencies installed. Start testing.
- shell: python # Sanity check
run: |
import lua
lg = lua.globals()
print(f"{lg = }")
print(f"{lg.string = }")
print(f"{lg.string.lower = }")
print(f"{lg.string.lower('Hello world!') = }")
assert lg.string.lower('Hello world!') != 'Hello world!'
assert lg.string.lower('Hello world!') == 'hello world!'
- run: python -m doctest tests/test_lua.py || true
- run: pip install pytest
- run: pytest || true
- run: pytest --doctest-modules || true
31 changes: 10 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
#!/usr/bin/python
#!/usr/bin/env python

import sys
import os
import sys
from distutils.sysconfig import get_python_lib
from subprocess import getstatusoutput
from sysconfig import get_config_var, get_python_version

if sys.version > '3':
PY3 = True
else:
PY3 = False

if PY3:
import subprocess as commands
else:
import commands
from distutils.core import setup, Extension
from distutils.sysconfig import get_config_var, get_python_lib, get_python_version
from setuptools import Extension, setup

if os.path.isfile("MANIFEST"):
os.unlink("MANIFEST")

lua_versions = ["5.5", "5.4", "5.3", "5.2", "5.1"]
lua_versions = ("5.5", "5.4", "5.3", "5.2", "5.1")

LUAVERSION = None
for version in lua_versions:
presult, poutput = commands.getstatusoutput("pkg-config --exists lua" + str(version))
presult, poutput = getstatusoutput("pkg-config --exists lua" + str(version))
if presult == 0:
LUAVERSION = version
break
Expand All @@ -43,7 +36,7 @@ def pkgconfig(*packages):

combined_pcoutput = ''
for package in packages:
(pcstatus, pcoutput) = commands.getstatusoutput(
(pcstatus, pcoutput) = getstatusoutput(
"pkg-config --libs --cflags %s" % package)
if pcstatus == 0:
combined_pcoutput += ' ' + pcoutput
Expand All @@ -59,11 +52,7 @@ def pkgconfig(*packages):
else: # throw others to extra_link_args
kwargs.setdefault('extra_link_args', []).append(token)

if PY3:
items = kwargs.items()
else:
items = kwargs.iteritems()
for k, v in items: # remove duplicated
for k, v in kwargs.items(): # remove duplicated
kwargs[k] = list(set(v))

return kwargs
Expand Down
Loading