api: Add script to print path of examples directory.

Partially fixes #92.
This commit is contained in:
derAnfaenger 2017-08-25 18:02:53 +02:00 committed by Tim Abbott
parent ae4bf8bbf4
commit 2f62507987
2 changed files with 16 additions and 0 deletions

View file

@ -59,6 +59,7 @@ package_info = dict(
entry_points={
'console_scripts': [
'zulip-send=zulip.send:main',
'zulip-api-examples=zulip.api_examples:main'
],
},
) # type: Dict[str, Any]

View file

@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import zulip
def main():
zulip_path = os.path.abspath(os.path.dirname(zulip.__file__))
examples_path = os.path.abspath(os.path.join(zulip_path, 'examples'))
if os.path.isdir(examples_path):
print(examples_path)
else:
raise OSError("Examples cannot be accessed at {}: Directory does not exist!"
.format(examples_path))
if __name__ == '__main__':
main()