Use entry_points for ipa CLI

Fix problem with hard-coded shebang in ipa command line tool by using
a proper setuptools entry point for the console script. ipaclient is now
an executable Python package, too.

```
$ python -m ipaclient ping
```

is equivalent to

```
$ ipa ping
```

Related: https://pagure.io/freeipa/issue/6653
Closes: https://pagure.io/freeipa/issue/6850
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
This commit is contained in:
Christian Heimes authored and Martin Basti committed 2017-04-11 13:29:50 +02:00
1 parent bad0f608c4
commit bf67974459
3 files changed
+22 -4

No files matched your search

+2 -3
View File
@@ -24,8 +24,7 @@ Command Line Interface for IPA administration.
The CLI functionality is implemented in ipalib/cli.py
"""
from ipalib import api, cli
from ipaclient.__main__ import main
if __name__ == '__main__':
cli.run(api)
main()
+15
View File
@@ -0,0 +1,15 @@
# Copyright (C) 2017 FreeIPA Contributors see COPYING for license
"""
Command Line Interface for IPA administration.
The CLI functionality is implemented in ipalib/cli.py
"""
from ipalib import api, cli
def main():
cli.run(api)
if __name__ == '__main__':
main()
+5 -1
View File
@@ -31,7 +31,6 @@ if __name__ == '__main__':
ipasetup(
name="ipaclient",
doc=__doc__,
scripts=['../ipa'],
package_dir={'ipaclient': ''},
packages=[
"ipaclient",
@@ -60,6 +59,11 @@ if __name__ == '__main__':
"qrcode",
"six",
],
entry_points={
'console_scripts': [
'ipa = ipaclient.__main__:main'
]
},
extras_require={
"install": ["ipaplatform"],
"otptoken_yubikey": ["yubico", "usb"]