mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Clean up shebangs for various files.
- Remove shebangs from: - ini files - unit tests - module_utils - plugins - module_docs_fragments - non-executable Makefiles - Change non-modules from '/usr/bin/python' to '/usr/bin/env python'. - Change '/bin/env' to '/usr/bin/env'. Also removed main functions from unit tests (since they no longer have a shebang) and fixed a python 3 compatibility issue with update_bundled.py so it does not need to specify a python 2 shebang. A script was added to check for unexpected shebangs in files. This script is run during CI on Shippable.
This commit is contained in:
parent
702ac436dc
commit
0d46805979
24 changed files with 26 additions and 40 deletions
1
Makefile
1
Makefile
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/make
|
||||
# WARN: gmake syntax
|
||||
########################################################
|
||||
# Makefile for Ansible
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright 2016 Doalitic.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# vim: set fileencoding=utf-8 :
|
||||
#
|
||||
# Copyright (C) 2016 Guido Günther <agx@sigxcpu.org>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright 2013 Google Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/env python
|
||||
#!/usr/bin/env python
|
||||
|
||||
'''
|
||||
nsot
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import requests
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/env python
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Spacewalk external inventory script
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/make
|
||||
SITELIB = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
||||
FORMATTER=../hacking/module_formatter.py
|
||||
DUMPER=../hacking/dump_playbook_attributes.py
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
from collections import namedtuple
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.vars import VariableManager
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python2 -tt
|
||||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import json
|
||||
|
@ -25,7 +25,7 @@ for filename in glob.glob(os.path.join(basedir, '../lib/ansible/compat/*/__init_
|
|||
continue
|
||||
metadata = json.loads(data)
|
||||
pypi_fh = open_url('https://pypi.python.org/pypi/{0}/json'.format(metadata['pypi_name']))
|
||||
pypi_data = json.loads(pypi_fh.read())
|
||||
pypi_data = json.loads(pypi_fh.read().decode('utf-8'))
|
||||
if LooseVersion(metadata['version']) < LooseVersion(pypi_data['info']['version']):
|
||||
print('UPDATE: {0} from {1} to {2} {3}'.format(
|
||||
metadata['pypi_name'],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
# long version of this one liner: python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < yamltest.txt
|
||||
import yaml
|
||||
import sys
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This code is part of Ansible, but is an independent component.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Red Hat, Inc.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2012-2013, Timothy Appnel <tim@appnel.com>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
|
||||
# Chris Houseknecht, <house@redhat.com>
|
||||
#
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
|
||||
# Chris Houseknecht, <house@redhat.com>
|
||||
#
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Red Hat, Inc.
|
||||
|
|
17
test/sanity/code-smell/shebang.sh
Executable file
17
test/sanity/code-smell/shebang.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
grep '^#!' -RIn . 2>/dev/null | grep ':1:' | sed 's/:1:/:/' | grep -v -E \
|
||||
-e '^\./lib/ansible/modules/' \
|
||||
-e '^\./test/integration/targets/[^/]*/library/[^/]*:#!powershell$' \
|
||||
-e ':#!/bin/sh$' \
|
||||
-e ':#!/bin/bash( -[eux]|$)' \
|
||||
-e ':#!/usr/bin/make -f$' \
|
||||
-e ':#!/usr/bin/env python$' \
|
||||
-e ':#!/usr/bin/env bash$' \
|
||||
-e ':#!/usr/bin/env fish$'
|
||||
|
||||
if [ $? -ne 1 ]; then
|
||||
echo "One or more file(s) listed above have an unexpected shebang."
|
||||
echo "See $0 for the list of acceptable values."
|
||||
exit 1
|
||||
fi
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from nose.plugins.skip import SkipTest
|
||||
|
||||
try:
|
||||
|
@ -489,9 +487,3 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
|
|||
)
|
||||
self.assertFalse(success)
|
||||
self.assertFalse(changed)
|
||||
|
||||
def main():
|
||||
unittest.main()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from nose.plugins.skip import SkipTest
|
||||
|
||||
try:
|
||||
|
@ -287,10 +285,3 @@ class AnsibleKinesisStreamFunctions(unittest.TestCase):
|
|||
self.assertTrue(changed)
|
||||
self.assertEqual(results, should_return)
|
||||
self.assertEqual(err_msg, 'Kinesis Stream test updated successfully.')
|
||||
|
||||
|
||||
def main():
|
||||
unittest.main()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2016, James Cammarata <jimi@sngx.net>
|
||||
#
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2015, Florian Apolloner <florian@apolloner.eu>
|
||||
#
|
||||
|
|
|
@ -20,6 +20,7 @@ test/sanity/code-smell/replace-urlopen.sh .
|
|||
test/sanity/code-smell/use-compat-six.sh lib
|
||||
test/sanity/code-smell/boilerplate.sh
|
||||
test/sanity/code-smell/required-and-default-attributes.sh
|
||||
test/sanity/code-smell/shebang.sh
|
||||
|
||||
shellcheck \
|
||||
test/integration/targets/*/*.sh \
|
||||
|
|
Loading…
Reference in a new issue