Skip to content

Commit

Permalink
Change hashbang of Python scripts to python3
Browse files Browse the repository at this point in the history
As described in PEP 394 there can be confusion when a script is executed
with the command "python". Many of the scripts changed in this commit are
Python3 (e.g. they call subprocess.run). On some systems the python
command is simply unavailable. On most distributions it is better to use
the command "python3".
  • Loading branch information
keestux committed Jul 6, 2023
1 parent 8f9c344 commit ccce75e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/test_playbook_runs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Authors:
# Sergio Oliveira Campos <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Authors:
# Sergio Oliveira Campos <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion utils/ansible-doc-test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down
14 changes: 7 additions & 7 deletions utils/build-galaxy-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ echo -e "\033[ACreating CHANGELOG.rst... \033[32;1mDONE\033[0m"

sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_freeipa_module/" plugins/modules/*.py

python utils/create_action_group.py "meta/runtime.yml" "$collection_prefix"
python3 utils/create_action_group.py "meta/runtime.yml" "$collection_prefix"

(cd plugins/module_utils && {
ln -sf ../../roles/*/module_utils/*.py .
Expand Down Expand Up @@ -145,43 +145,43 @@ done
echo "Fixing examples in plugins/modules..."
find plugins/modules -name "*.py" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-module-EXAMPLES.py "$line" \
python3 utils/galaxyfy-module-EXAMPLES.py "$line" \
"ipa" "$collection_prefix"
done
echo -e "\033[AFixing examples in plugins/modules... \033[32;1mDONE\033[0m"

echo "Fixing examples in roles/*/library..."
find roles/*/library -name "*.py" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-module-EXAMPLES.py "$line" \
python3 utils/galaxyfy-module-EXAMPLES.py "$line" \
"ipa" "$collection_prefix"
done
echo -e "\033[AFixing examples in roles/*/library... \033[32;1mDONE\033[0m"

echo "Fixing playbooks in roles/*/tasks..."
for line in roles/*/tasks/*.yml; do
python utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
python3 utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
done
echo -e "\033[AFixing playbooks in roles/*tasks... \033[32;1mDONE\033[0m"

echo "Fixing playbooks in playbooks..."
find playbooks -name "*.yml" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
python3 utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
done
echo -e "\033[AFixing playbooks in playbooks... \033[32;1mDONE\033[0m"

echo "Fixing README(s)..."
find . -name "README*.md" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-README.py "$line" "ipa" "$collection_prefix"
python3 utils/galaxyfy-README.py "$line" "ipa" "$collection_prefix"
done
echo -e "\033[AFixing examples in plugins/modules... \033[32;1mDONE\033[0m"

echo "Fixing playbooks in tests..."
find tests -name "*.yml" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
python3 utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
done
echo -e "\033[AFixing playbooks in tests... \033[32;1mDONE\033[0m"

Expand Down
2 changes: 1 addition & 1 deletion utils/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down
2 changes: 1 addition & 1 deletion utils/check_test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""Check which tests are scheduled to be executed."""

Expand Down
2 changes: 1 addition & 1 deletion utils/galaxyfy-README.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down
2 changes: 1 addition & 1 deletion utils/galaxyfy-module-EXAMPLES.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down
2 changes: 1 addition & 1 deletion utils/galaxyfy-playbook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down
2 changes: 1 addition & 1 deletion utils/galaxyfy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Authors:
Expand Down

0 comments on commit ccce75e

Please sign in to comment.