Skip to content

Commit

Permalink
autopep8
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Winter committed Sep 8, 2022
1 parent 65174cc commit 99d9214
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .pep8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pycodestyle]
max_line_length = 120
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ repos:
hooks:
- id: pylint
exclude: ^(conan/conanfile.py|scripts/genignore.py)
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
exclude: ^(conan/conanfile.py)
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
Expand Down
52 changes: 28 additions & 24 deletions scripts/genignore.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
import os, stat
import os
import stat

# Run this on Linux.

Expand All @@ -11,29 +12,32 @@
# slips through the cracks using
# find . -type f -executable

sourceDirectory = os.path.abspath( os.path.dirname( os.path.dirname( __file__ ) ) )
sourceDirectory = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))


def ignoredFiles():
ret = []
def findExecutables( top ):
for f in os.listdir( top ):
pathname = os.path.join( top, f )
if stat.S_ISDIR( os.stat( pathname ).st_mode ):
findExecutables( pathname )
elif os.access( pathname, os.X_OK ):
# The file is executable for us
ret.append( pathname + '$' )
# for OS X
ret.append( pathname + '.app/' )

# With one exception, the executables in those paths are binaries and we're making a SOURCE package.
for path in [ 'unittests' ]:
findExecutables( os.path.join( sourceDirectory, path ) )
# The exception!
def isGoodExclude(s): return not s.startswith( os.path.join( sourceDirectory, 'unittests/runTest.bat' ) )
return sorted( filter( isGoodExclude, ret ) )

f = open( 'CPackIgnores.txt', 'w')
ret = []

def findExecutables(top):
for f in os.listdir(top):
pathname = os.path.join(top, f)
if stat.S_ISDIR(os.stat(pathname).st_mode):
findExecutables(pathname)
elif os.access(pathname, os.X_OK):
# The file is executable for us
ret.append(pathname + '$')
# for OS X
ret.append(pathname + '.app/')

# With one exception, the executables in those paths are binaries and we're making a SOURCE package.
for path in ['unittests']:
findExecutables(os.path.join(sourceDirectory, path))
# The exception!
def isGoodExclude(s): return not s.startswith(os.path.join(sourceDirectory, 'unittests/runTest.bat'))
return sorted(filter(isGoodExclude, ret))


f = open('CPackIgnores.txt', 'w')
for ign in ignoredFiles():
# write paths relative to the source dir, one per line
f.write( ign[ len( sourceDirectory ) : ] + '\n' )
# write paths relative to the source dir, one per line
f.write(ign[len(sourceDirectory):] + '\n')

0 comments on commit 99d9214

Please sign in to comment.