Skip to content

Commit 25f1ba0

Browse files
committed
small change to structure so that the default vector data is included in the python package
1 parent 509e943 commit 25f1ba0

File tree

9 files changed

+11
-8
lines changed

9 files changed

+11
-8
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

collect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_all_db_files():
4848

4949

5050
def get_winapi1024_path():
51-
return get_this_dir() + os.sep + "data" + os.sep + "winapi1024v1.txt"
51+
return get_this_dir() + os.sep + "apiscout" + os.sep + "data" + os.sep + "winapi1024v1.txt"
5252

5353

5454
def get_file_list(root_path, required_part):

export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_this_dir():
3939
return os.path.abspath(os.path.join(os.path.dirname(__file__)))
4040

4141
def get_winapi1024_path():
42-
return get_this_dir() + os.sep + "data" + os.sep + "winapi1024v1.txt"
42+
return get_this_dir() + os.sep + "apiscout" + os.sep + "data" + os.sep + "winapi1024v1.txt"
4343

4444

4545
def main():

match.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_this_dir():
3939
return os.path.abspath(os.path.join(os.path.dirname(__file__)))
4040

4141
def get_winapi1024_path():
42-
return get_this_dir() + os.sep + "data" + os.sep + "winapi1024v1.txt"
42+
return get_this_dir() + os.sep + "apiscout" + os.sep + "data" + os.sep + "winapi1024v1.txt"
4343

4444

4545
def main():

scout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_all_db_files():
4545

4646

4747
def get_winapi1024_path():
48-
return get_this_dir() + os.sep + "data" + os.sep + "winapi1024v1.txt"
48+
return get_this_dir() + os.sep + "apiscout" + os.sep + "data" + os.sep + "winapi1024v1.txt"
4949

5050

5151
def get_base_addr(args):

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
author_email='[email protected]',
1919
url='https://github.com/daniel-plohmann/apiscout',
2020
license=LICENSE,
21-
packages=find_packages(exclude=('tests', 'docs'))
21+
# packages=find_packages(exclude=('tests', 'docs')),
22+
packages = ["apiscout"],
23+
package_data={"apiscout": ["data/winapi1024v1.txt"]},
2224
)

tests/testVector.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import unittest
3030

3131
from apiscout.ApiVector import ApiVector
32+
import apiscout
3233

3334
LOG = logging.getLogger(__name__)
3435
logging.basicConfig(level=logging.INFO, format="%(asctime)-15s %(message)s")
@@ -97,9 +98,9 @@ def testDictConversions(self):
9798
self.assertEquals(result_dict, expected)
9899

99100
def testLoadWinApi1024Definition(self):
100-
THIS_FILE_PATH = str(os.path.abspath(__file__))
101-
PROJECT_ROOT = str(os.path.abspath(os.sep.join([THIS_FILE_PATH, "..", ".."])))
102-
winapi_path = os.sep.join([PROJECT_ROOT , "data", "winapi1024v1.txt"])
101+
module_path = os.path.dirname(os.path.realpath(apiscout.__file__))
102+
LOG.info("Using module path %s" % module_path)
103+
winapi_path = os.sep.join([module_path, "data", "winapi1024v1.txt"])
103104
apivector = ApiVector(winapi_path)
104105
self.assertEquals(len(apivector._winapi1024), 1024)
105106

0 commit comments

Comments
 (0)