Skip to content

Commit

Permalink
README, PROJECT_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
ashariyar committed Oct 11, 2022
1 parent aa38e5c commit cbee55d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
5 changes: 3 additions & 2 deletions pdfalyzer/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import importlib.resources
import logging
from os import environ, path
from os import environ, pardir, path

from yaralyzer.config import YaralyzerConfig, is_env_var_set_and_not_false, is_invoked_by_pytest

PDFALYZE = 'pdfalyze'
PROJECT_ROOT = path.join(str(importlib.resources.files('pdfalyzer')), pardir)
PYTEST_FLAG = 'INVOKED_BY_PYTEST'

# Configuring PDFALYZER_LOG_DIR has side effects; see .pdfalyzer.example in repo for specifics.
Expand All @@ -22,7 +23,7 @@
class PdfalyzerConfig:
JAVSCRIPT_KEYWORD_ALERT_THRESHOLD = 2
QUOTE_TYPE = None
DEFAULT_PDF_PARSER_EXECUTABLE = path.join(str(importlib.resources.files('pdfalyzer')), 'tools', 'pdf-parser.py')
DEFAULT_PDF_PARSER_EXECUTABLE = path.join(PROJECT_ROOT, 'tools', 'pdf-parser.py')

# Path to Didier Stevens's pdf-parser.py
if is_env_var_set_and_not_false(PDF_PARSER_EXECUTABLE_ENV_VAR):
Expand Down
13 changes: 0 additions & 13 deletions pdfalyzer/util/filesystem_awareness.py

This file was deleted.

13 changes: 10 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
from os import environ, path, remove
from os import environ, path, pardir, remove
import importlib.resources
import pathlib
environ['INVOKED_BY_PYTEST'] = 'True'

import pytest
from yaralyzer.config import MAX_DECODE_LENGTH_ENV_VAR, YaralyzerConfig
from yaralyzer.helpers.file_helper import files_in_dir

from pdfalyzer.pdfalyzer import Pdfalyzer
from pdfalyzer.util.filesystem_awareness import DOCUMENTATION_DIR


PROJECT_DIR = path.join(str(importlib.resources.files('pdfalyzer')), pardir)
DOCUMENTATION_DIR = path.join(PROJECT_DIR, 'doc')
SVG_DIR = path.join(DOCUMENTATION_DIR, 'svgs')
RENDERED_IMAGES_DIR = path.join(SVG_DIR, 'rendered_images')



# Full paths to PDF test fixtures
Expand Down

0 comments on commit cbee55d

Please sign in to comment.