Merge pull request #37 from ben-edna/feature/cross-platform-setup

Feature/cross platform setup

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
This commit is contained in:
David A. Wheeler 2021-03-21 17:44:11 -04:00 committed by GitHub
commit 9a181d4103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

5
flawfinder → flawfinder.py Executable file → Normal file
View File

@ -2352,8 +2352,11 @@ def flawfind():
return 1 if error_level_exceeded else 0 return 1 if error_level_exceeded else 0
if __name__ == '__main__': def main():
try: try:
sys.exit(flawfind()) sys.exit(flawfind())
except KeyboardInterrupt: except KeyboardInterrupt:
print("*** Flawfinder interrupted") print("*** Flawfinder interrupted")
if __name__ == '__main__':
main()

View File

@ -67,7 +67,7 @@ INSTALL_DATA=cp -p
# compiled code to override later uncompiled Python code. # compiled code to override later uncompiled Python code.
install: install:
-$(MKDIR_P) $(DESTDIR)$(INSTALL_DIR_BIN) -$(MKDIR_P) $(DESTDIR)$(INSTALL_DIR_BIN)
$(INSTALL_PROGRAM) flawfinder $(DESTDIR)$(INSTALL_DIR_BIN)/flawfinder$(PYTHONEXT) $(INSTALL_PROGRAM) flawfinder.py $(DESTDIR)$(INSTALL_DIR_BIN)/flawfinder$(PYTHONEXT)
-$(MKDIR_P) $(DESTDIR)$(INSTALL_DIR_MAN) -$(MKDIR_P) $(DESTDIR)$(INSTALL_DIR_MAN)
$(INSTALL_DATA) flawfinder.1 $(DESTDIR)$(INSTALL_DIR_MAN)/flawfinder.1 $(INSTALL_DATA) flawfinder.1 $(DESTDIR)$(INSTALL_DIR_MAN)/flawfinder.1
@ -129,7 +129,7 @@ upload-pypi:
time: time:
echo "Timing the program. First, time taken:" echo "Timing the program. First, time taken:"
time ./flawfinder $(SAMPLE_DIR)/*/*.[ch] > /dev/null time ./flawfinder.py $(SAMPLE_DIR)/*/*.[ch] > /dev/null
echo "Lines examined:" echo "Lines examined:"
wc -l $(SAMPLE_DIR)/*/*.[ch] | tail -2 wc -l $(SAMPLE_DIR)/*/*.[ch] | tail -2
@ -145,7 +145,7 @@ test-is-correct:
cd $(TESTDIR); $(MAKE) test-is-correct cd $(TESTDIR); $(MAKE) test-is-correct
profile: profile:
/usr/lib/python1.5/profile.py ./flawfinder > profile-results $(SAMPLE_DIR)/*/*.[ch] > profile-results /usr/lib/python1.5/profile.py ./flawfinder.py > profile-results $(SAMPLE_DIR)/*/*.[ch] > profile-results
rpm: distribute rpm: distribute
@ -184,7 +184,7 @@ cwe: cwe.c
$(CC) -o cwe cwe.c -lfl $(CC) -o cwe cwe.c -lfl
show-cwes: cwe show-cwes: cwe
./cwe < flawfinder | sort -u -V ./cwe < flawfinder.py | sort -u -V
pylint: pylint:
pylint flawfinder pylint flawfinder

View File

@ -41,7 +41,11 @@ It is released under the GNU GPL license.""",
'Topic :: Software Development :: Testing' 'Topic :: Software Development :: Testing'
], ],
python_requires = '>=2.7', python_requires = '>=2.7',
scripts = [ 'flawfinder' ], entry_points={
'console_scripts': [
'flawfinder = flawfinder:main',
],
},
data_files = [ ('share/man/man1', [ 'flawfinder.1.gz' ]) ], data_files = [ ('share/man/man1', [ 'flawfinder.1.gz' ]) ],
py_modules = [ ], py_modules = ['flawfinder'],
) )

View File

@ -5,7 +5,7 @@
PYTHON=python PYTHON=python
PYTHON2=python2 PYTHON2=python2
PYTHON3=python3 PYTHON3=python3
FLAWFINDER=../flawfinder FLAWFINDER=../flawfinder.py
SETUPPY=../setup.py SETUPPY=../setup.py
test_001: $(FLAWFINDER) test.c test2.c test_001: $(FLAWFINDER) test.c test2.c