Skip to content

Commit

Permalink
Merge pull request #51 from lumapps/bug_fix_release
Browse files Browse the repository at this point in the history
Fixed a bug making go build not working
  • Loading branch information
Ilan Piperno authored Aug 26, 2019
2 parents 132f4ab + 7712f4d commit c387978
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include LICENSE
include README.md
include dep_check/lib/find_dependencies.go
include dep_check/lib/goparse.c
include dep_check/infra/lib/find_dependencies.go
include dep_check/infra/lib/goparse.c

recursive-include tests *
recursive-exclude * __pycache__
Expand Down
13 changes: 8 additions & 5 deletions dep_check/infra/go_parser.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import logging
from os import chdir
from os import chdir, environ, getcwd, path
from subprocess import CalledProcessError, run

from dep_check.dependency_finder import IParser
from dep_check.models import Dependencies, Dependency, ModuleWildcard, SourceFile

try:
from dep_check.lib import goparse
from .lib import goparse
except ImportError:
chdir("dep_check/lib")
CURRENT_WD = getcwd()

chdir("{}/lib".format(path.dirname(path.realpath(__file__))))
try:
environ["CGO_ENABLED"] = "1"
run(["go", "build", "-buildmode=c-shared", "-o", "goparse.so"], check=True)
from dep_check.lib import goparse # pylint: disable=no-name-in-module
from .lib import goparse # pylint: disable=no-name-in-module
except (CalledProcessError, FileNotFoundError):
logging.warning(
"Couldn't load GO library, you won't be able to use dep-check on GO projects."
Expand All @@ -20,7 +23,7 @@
logging.warning(
"Couldn't importy GO library, you won't be able to use dep-check on GO projects."
)
chdir("../..")
chdir(CURRENT_WD)


class GoParser(IParser):
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dependency_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependency_rules:
- dep_check.use_cases.interfaces

dep_check.infra.go_parser:
- dep_check.lib.goparse
- dep_check.infra.lib.goparse

dep_check.use_cases%:
- dep_check.use_cases.app_configuration
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ line_length=88
multi_line_output=3
use_parentheses=True

[mypy-dep_check.lib]
[mypy-dep_check.infra.lib]
ignore_missing_imports = True

0 comments on commit c387978

Please sign in to comment.