1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

few tweaks for python3 support

* switch from script to entry_points in setup.py
* move the cli script in ldapcherry (to be used as a module)
* put the __main__ code in a dedicated function constituting the entry
point
* add a few python3 environments in travis file
This commit is contained in:
kakwa 2019-02-07 20:34:49 +01:00
parent 3d6e24eb73
commit c81429a870
3 changed files with 27 additions and 9 deletions

View File

@ -8,12 +8,9 @@ language: python
before_install: before_install:
- '[ "$TEST_PEP8" == "1" ] || sudo ./tests/test_env/deploy.sh' - '[ "$TEST_PEP8" == "1" ] || sudo ./tests/test_env/deploy.sh'
python:
- "2.7"
install: install:
- pip install -e . - pip install -e .
- "if [[ $TEST_PEP8 == '1' ]]; then pip install pep8; fi" - "if [[ $TEST_PEP8 == '1' ]]; then pip install pycodestyle; fi"
- pip install passlib - pip install passlib
- pip install coveralls - pip install coveralls
@ -21,11 +18,23 @@ install:
# #
#script: #script:
# - coverage run --source=ldapcherry setup.py test # - coverage run --source=ldapcherry setup.py test
script: "if [[ $TEST_PEP8 == '1' ]]; then pep8 --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg,tests,misc,setup.py . scripts/ldapcherryd; else coverage run --source=ldapcherry setup.py test; fi" script: "if [[ $TEST_PEP8 == '1' ]]; then pycodestyle --repeat --show-source --exclude=.venv,.tox,dist,docs,build,*.egg,tests,misc,setup.py . scripts/ldapcherryd; else coverage run --source=ldapcherry setup.py test; fi"
matrix: matrix:
include: include:
- python: "2.7" - python: "2.7"
env: TEST_PEP8=1 env: TEST_PEP8=1
- python: "2.7"
env: TEST_PEP8=0
- python: "3.5"
env: TEST_PEP8=0
- python: "3.6"
env: TEST_PEP8=0
- python: "3.4"
env: TEST_PEP8=0
- python: "3.7"
env: TEST_PEP8=0
after_success: after_success:
- coveralls - coveralls
after_failure: after_failure:

View File

@ -102,7 +102,7 @@ def start(configfile=None, daemonize=False, environment=None,
engine.block() engine.block()
if __name__ == '__main__': def main():
from optparse import OptionParser from optparse import OptionParser
p = OptionParser() p = OptionParser()
@ -142,3 +142,6 @@ if __name__ == '__main__':
start(options.config, options.daemonize, start(options.config, options.daemonize,
options.environment, options.fastcgi, options.scgi, options.environment, options.fastcgi, options.scgi,
options.pidfile, options.cgi, options.debug) options.pidfile, options.cgi, options.debug)
if __name__ == '__main__':
main()

View File

@ -29,8 +29,12 @@ if sys.version_info[0] == 2:
'Mako' 'Mako'
], ],
elif sys.version_info[0] == 3: elif sys.version_info[0] == 3:
print('unsupported version') install_requires = [
exit(1) 'CherryPy >= 3.0.0',
'python-ldap',
'PyYAML',
'Mako'
],
else: else:
print('unsupported version') print('unsupported version')
exit(1) exit(1)
@ -120,7 +124,9 @@ setup(
'ldapcherry.ppolicy' 'ldapcherry.ppolicy'
], ],
data_files=resources_files, data_files=resources_files,
scripts=['scripts/ldapcherryd'], entry_points = {
'console_scripts': ['ldapcherryd = ldapcherry.cli:main']
},
url='https://github.com/kakwa/ldapcherry', url='https://github.com/kakwa/ldapcherry',
license=license, license=license,
description=small_description, description=small_description,