mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Make scripts into symlinks
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.
This commit is contained in:
20
setup.py
20
setup.py
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('lib'))
|
||||
@@ -18,6 +19,25 @@ with open('requirements.txt') as requirements_file:
|
||||
"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__,
|
||||
|
||||
Reference in New Issue
Block a user