obey style guide and make build.sh more readable

The script build.sh should be more readable now, and a little less
error-prone as it creates the parsedmarc-docs directory if it is missing
This commit is contained in:
Arrigo Marchiori
2019-08-03 11:15:21 +02:00
parent 623eeddc8e
commit 537651836b
3 changed files with 21 additions and 5 deletions

View File

@@ -1,4 +1,19 @@
#!/usr/bin/env bash
set -e
. venv/bin/activate
pip install -U -r requirements.txt && rstcheck --report warning README.rst && cd docs && make html && touch _build/html/.nojekyll && cp -rf _build/html/* ../../parsedmarc-docs/ && cd .. && flake8 parsedmarc && flake8 tests.py && rm -rf dist/ build/ && python3 setup.py sdist && python3 setup.py bdist_wheel
pip install -U -r requirements.txt
rstcheck --report warning README.rst
cd docs
make html
touch _build/html/.nojekyll
mkdir -p ../../parsedmarc-docs/
cp -rf _build/html/* ../../parsedmarc-docs/
cd ..
flake8 parsedmarc
flake8 tests.py
rm -rf dist/ build/
python3 setup.py sdist
python3 setup.py bdist_wheel

View File

@@ -921,7 +921,8 @@ def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0,
mbox = mailbox.mbox(input_)
message_keys = mbox.keys()
total_messages = len(message_keys)
logger.debug("Found {0} messages in {1}".format(total_messages, input_))
logger.debug("Found {0} messages in {1}".format(total_messages,
input_))
for i in range(len(message_keys)):
message_key = message_keys[i]
logger.debug("Processing message {0} of {1}".format(
@@ -929,12 +930,12 @@ def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0,
))
msg_content = mbox.get_string(message_key)
try:
sa = strip_attachment_payloads
parsed_email = parse_report_email(msg_content,
offline=offline,
nameservers=nameservers,
dns_timeout=dns_timeout,
strip_attachment_payloads=\
strip_attachment_payloads,
strip_attachment_payloads=sa,
parallel=parallel)
if parsed_email["report_type"] == "aggregate":
aggregate_reports.append(parsed_email["report"])

View File

@@ -548,7 +548,7 @@ def _main():
opts.offline, False)
aggregate_reports += reports["aggregate_reports"]
forensic_reports += reports["forensic_reports"]
if opts.imap_host:
try:
if opts.imap_user is None or opts.imap_password is None: