Skip to content

Commit

Permalink
Use setuptools entry points instead of a custom script
Browse files Browse the repository at this point in the history
Should fix fboender#190 and related issues (e.g. the script will not work
correctly ansible-cmdb if it's been installed into a non-activated
virtualenv).
  • Loading branch information
mgedmin committed Nov 5, 2020
1 parent 43efad1 commit 058a212
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 76 deletions.
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ def get_data_files(path, strip='', prefix=''):
package_dir={'': 'src'},
packages=find_packages('src'),
include_package_data=True,
data_files=\
data_files=
get_data_files(
'src/ansiblecmdb/data',
strip='src',
prefix='lib'
) +
[['lib/ansiblecmdb/', ['src/ansible-cmdb.py']]],
),
zip_safe=False,
install_requires=['mako', 'pyyaml', 'ushlex', 'jsonxs'],
scripts=[
'src/ansible-cmdb',
],
entry_points={
'console_scripts': [
'ansible-cmdb = ansiblecmdb.cli:main',
],
},

classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down
69 changes: 0 additions & 69 deletions src/ansible-cmdb

This file was deleted.

5 changes: 4 additions & 1 deletion src/ansible-cmdb.py → src/ansiblecmdb/cli.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def parse_user_params(user_params):
return {}


if __name__ == "__main__":
def main():
log = get_logger()
data_dir = get_data_dir()
tpl_dir = os.path.join(data_dir, 'tpl')
Expand Down Expand Up @@ -243,3 +243,6 @@ def parse_user_params(user_params):
"""
sys.stderr.write(debug_txt)
sys.exit(1)

if __name__ == "__main__":
main()

0 comments on commit 058a212

Please sign in to comment.