Browse Source

Merge pull request #994 from octodns/script-formatting

Include script directory in lint & formatting
pull/995/head
Ross McFarland 3 years ago
committed by GitHub
parent
commit
229c59b110
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 5 deletions
  1. +1
    -0
      requirements-dev.txt
  2. +1
    -0
      requirements.txt
  3. +1
    -1
      script/format
  4. +1
    -1
      script/lint
  5. +9
    -3
      script/update-requirements

+ 1
- 0
requirements-dev.txt View File

@ -1,3 +1,4 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
Pygments==2.13.0 Pygments==2.13.0
attrs==22.1.0 attrs==22.1.0
black==22.10.0 black==22.10.0


+ 1
- 0
requirements.txt View File

@ -1,3 +1,4 @@
# DO NOT EDIT THIS FILE DIRECTLY - use ./script/update-requirements to update
PyYAML==6.0 PyYAML==6.0
dnspython==2.3.0 dnspython==2.3.0
fqdn==1.5.1 fqdn==1.5.1


+ 1
- 1
script/format View File

@ -2,7 +2,7 @@
set -e set -e
SOURCES=$(find *.py octodns tests -name "*.py")
SOURCES="$(find *.py octodns tests -name '*.py') $(grep --files-with-matches '^#!.*python' script/*)"
. env/bin/activate . env/bin/activate


+ 1
- 1
script/lint View File

@ -15,6 +15,6 @@ if [ ! -f "$ACTIVATE" ]; then
fi fi
. "$ACTIVATE" . "$ACTIVATE"
SOURCES="*.py octodns/*.py octodns/*/*.py tests/*.py"
SOURCES="$(find *.py octodns tests -name '*.py') $(grep --files-with-matches '^#!.*python' script/*)"
pyflakes $SOURCES pyflakes $SOURCES

+ 9
- 3
script/update-requirements View File

@ -1,9 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re
from os.path import join from os.path import join
from subprocess import check_call, check_output from subprocess import check_call, check_output
from sys import argv
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
import re
def print_packages(packages, heading): def print_packages(packages, heading):
@ -37,16 +38,21 @@ with TemporaryDirectory() as tmpdir:
# pip installs the module itself along with deps so we need to get that out of # pip installs the module itself along with deps so we need to get that out of
# our list by finding the thing that was file installed during dev # our list by finding the thing that was file installed during dev
frozen = sorted([p for p in frozen if not p.startswith(our_package_name)]) frozen = sorted([p for p in frozen if not p.startswith(our_package_name)])
dev_frozen = sorted([p for p in dev_frozen
if not p.startswith(our_package_name)])
dev_frozen = sorted(
[p for p in dev_frozen if not p.startswith(our_package_name)]
)
print_packages(frozen, 'frozen') print_packages(frozen, 'frozen')
print_packages(dev_frozen, 'dev_frozen') print_packages(dev_frozen, 'dev_frozen')
script = argv[0]
with open('requirements.txt', 'w') as fh: with open('requirements.txt', 'w') as fh:
fh.write(f'# DO NOT EDIT THIS FILE DIRECTLY - use {script} to update\n')
fh.write('\n'.join(frozen)) fh.write('\n'.join(frozen))
fh.write('\n') fh.write('\n')
with open('requirements-dev.txt', 'w') as fh: with open('requirements-dev.txt', 'w') as fh:
fh.write(f'# DO NOT EDIT THIS FILE DIRECTLY - use {script} to update\n')
fh.write('\n'.join(dev_frozen)) fh.write('\n'.join(dev_frozen))
fh.write('\n') fh.write('\n')

Loading…
Cancel
Save