Skip to content

Commit

Permalink
Move setup.py to the top-level and provide MANIFEST.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Apr 22, 2024
1 parent 166aff7 commit bcf71a6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ jobs:
pip install -r python/requirements.txt
- name: build
run: CC=${COMPILER} ${PYTHON_CMD} python/setup.py build
run: CC=${COMPILER} ${PYTHON_CMD} setup.py build sdist

- name: install
run: pip install python/
run: |
ls -l dist/
pip install dist/G722*.gz
- name: test
run: ./scripts/do-test.sh "${PYTHON_CMD} test.py"
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include g722.h g722_codec.h g722_common.h g722_decoder.h g722_encoder.h g722_private.h
include python/requirements.txt python/symbols.map
4 changes: 3 additions & 1 deletion python/G722_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ PyG722_encode(PyG722* self, PyObject* args) {
free(array);
}
e1:
Py_DECREF(seq);
if (!PyArray_Check(item)) {
Py_DECREF(seq);
}
e0:
return rval;
}
Expand Down
44 changes: 23 additions & 21 deletions python/setup.py → setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,28 @@
module1 = Extension(mod_name, **mod_common_args)
module2 = Extension(mod_name_dbg, **mod_debug_args)

class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")]

def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []

def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
exit(errno)

requirements = [x.strip() for x in open(mod_dir + "requirements.txt", "r").readlines()]
with open(src_dir + "README.md", "r") as fh:
long_description = fh.read()

kwargs = {
'name':mod_name,
'version':'1.1',
'description':'This is a package for G.722 module',
'long_description': long_description,
'long_description_content_type': "text/markdown",
'author':'Maksym Sobolyev',
'author_email':'[email protected]',
'url':'https://github.com/sippy/libg722',
'ext_modules': [module1, module2],
'python_requires': '>=3.10',
'install_requires': requirements,
'classifiers': [
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Programming Language :: C',
'Programming Language :: Python'
]
}

setup (name = mod_name,
version = '1.0',
description = 'This is a package for G.722 module',
ext_modules = [module1, module2],
tests_require=['pytest'],
cmdclass={'test': PyTest},
install_requires = requirements,
)

setup (**kwargs)

0 comments on commit bcf71a6

Please sign in to comment.