Skip to content

Commit

Permalink
Use entry_points instead of scripts for cross-platform compatibility
Browse files Browse the repository at this point in the history
This makes `tx` work right out of the box when you `pip install transifex-client` on Windows.
  • Loading branch information
akx committed Dec 11, 2015
1 parent 72ea2a3 commit 8f31be9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contrib/tx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ added_files = [
('../txclib/cacert.pem', 'txclib'),
]

a = Analysis(['../tx'],
a = Analysis(['../txclib/cmdline.py'],
binaries=None,
datas=added_files,
hiddenimports=[],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_file_content(filename):
setup(
name="transifex-client",
version=txclib.__version__,
scripts=['tx'],
entry_points={'console_scripts': ['tx=txclib.cmdline:main']},
description="A command line interface for Transifex",
long_description=get_file_content('README.rst'),
author="Transifex",
Expand Down
6 changes: 4 additions & 2 deletions tx → txclib/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def exithandler(signum,frame):
sys.setdefaultencoding('utf-8')


def main(argv):
def main(argv=None):
"""
Here we parse the flags (short, long) and we instantiate the classes.
"""
if argv is None:
argv = sys.argv[1:]
usage = "usage: %prog [options] command [cmd_options]"
description = "This is the Transifex command line client which"\
" allows you to manage your translations locally and sync"\
Expand Down Expand Up @@ -110,4 +112,4 @@ def main(argv):
# Run baby :) ... run
if __name__ == "__main__":
# sys.argv[0] is the name of the script that we’re running.
main(sys.argv[1:])
main()

0 comments on commit 8f31be9

Please sign in to comment.