Skip to content

Commit

Permalink
Make scripts into symlinks
Browse files Browse the repository at this point in the history
pip can't handle zip files with symlinks.  Attempt to workaround that by
transforming the bin scripts into symlinks after the zip file has been
unarchived into the build tree.
  • Loading branch information
abadger committed Apr 4, 2017
1 parent 3180b47 commit 57a7d77
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import os.path
import sys

sys.path.insert(0, os.path.abspath('lib'))
Expand All @@ -18,6 +19,25 @@
"That indicates this copy of the source code is incomplete.")
sys.exit(2)

SYMLINKS = {'ansible': frozenset(('ansible-console',
'ansible-doc',
'ansible-galaxy',
'ansible-playbook',
'ansible-pull',
'ansible-vault'))}

for source in SYMLINKS:
for dest in SYMLINKS[source]:
dest_path = os.path.join('bin', dest)
if not os.path.islink(dest_path):
try:
os.unlink(dest_path)
except OSError as e:
if e.errno == 2:
# File does not exist which is all we wanted
pass
os.symlink(source, dest_path)

setup(
name='ansible',
version=__version__,
Expand Down

0 comments on commit 57a7d77

Please sign in to comment.