|
|
@ -46,42 +46,6 @@ from __future__ import print_function |
|
|
|
from setuptools import Command, setup |
|
|
|
from setuptools import Command, setup |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class run_audit(Command): |
|
|
|
|
|
|
|
"""Audits source code using PyFlakes for following issues: |
|
|
|
|
|
|
|
- Names which are used but not defined or used before they are defined. |
|
|
|
|
|
|
|
- Names which are redefined without having been used. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
description = "Audit source code with PyFlakes" |
|
|
|
|
|
|
|
user_options = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_options(self): |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def finalize_options(self): |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
|
|
|
|
import os |
|
|
|
|
|
|
|
import sys |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
import pyflakes.scripts.pyflakes as flakes |
|
|
|
|
|
|
|
except ImportError: |
|
|
|
|
|
|
|
print("Audit requires PyFlakes installed in your system.") |
|
|
|
|
|
|
|
sys.exit(-1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
warns = 0 |
|
|
|
|
|
|
|
# Define top-level directories |
|
|
|
|
|
|
|
dirs = ('flask', 'examples', 'scripts') |
|
|
|
|
|
|
|
for dir in dirs: |
|
|
|
|
|
|
|
for root, _, files in os.walk(dir): |
|
|
|
|
|
|
|
for file in files: |
|
|
|
|
|
|
|
if file != '__init__.py' and file.endswith('.py'): |
|
|
|
|
|
|
|
warns += flakes.checkPath(os.path.join(root, file)) |
|
|
|
|
|
|
|
if warns > 0: |
|
|
|
|
|
|
|
print("Audit finished with total %d warnings." % warns) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
print("No problems found in sourcecode.") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup( |
|
|
|
setup( |
|
|
|
name='Flask', |
|
|
|
name='Flask', |
|
|
|
version='0.11-dev', |
|
|
|
version='0.11-dev', |
|
|
@ -116,6 +80,5 @@ setup( |
|
|
|
entry_points=''' |
|
|
|
entry_points=''' |
|
|
|
[console_scripts] |
|
|
|
[console_scripts] |
|
|
|
flask=flask.cli:main |
|
|
|
flask=flask.cli:main |
|
|
|
''', |
|
|
|
''' |
|
|
|
cmdclass={'audit': run_audit} |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|