Skip to content

Commit

Permalink
[index] Index fix review comments2 (cliqz-oss#53)
Browse files Browse the repository at this point in the history
simplify setup.py and test for merger script
  • Loading branch information
Hendrik Muhs authored Mar 15, 2018
1 parent 505fe5c commit bd14fe5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
2 changes: 1 addition & 1 deletion keyvi/include/keyvi/index/internal/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Segment final : public ReadOnlySegment {
deleted_keys_swap_filename_ += ".dk-swap";
}

explicit Segment(const boost::filesystem::path& path, const std::vector<std::shared_ptr<Segment>> parent_segments,
explicit Segment(const boost::filesystem::path& path, const std::vector<std::shared_ptr<Segment>>& parent_segments,
const bool load = true)
: ReadOnlySegment(path),
deleted_keys_for_write_(),
Expand Down
9 changes: 2 additions & 7 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class bdist_wheel(custom_opts, _bdist_wheel.bdist_wheel):
have_wheel = True
except: None

class build_py(_build_py.build_py):
class build_ext(_build_ext.build_ext):

def run(self):
generate_pykeyvi_source()
Expand Down Expand Up @@ -246,11 +246,6 @@ def run(self):
print ("Building keyvi C++ part: " + keyvi_build_cmd)
subprocess.call(keyvi_build_cmd, shell=True)

_build_py.build_py.run(self)

class build_ext(_build_ext.build_ext):

def run(self):
os.environ['ARCHFLAGS'] = '-arch x86_64'
_build_ext.build_ext.run(self)

Expand Down Expand Up @@ -280,7 +275,7 @@ def run(self):
'msgpack-python',
]

commands = {'build_py': build_py, 'build_ext': build_ext, 'sdist': sdist, 'build': build, 'bdist': bdist}
commands = {'build_ext': build_ext, 'sdist': sdist, 'build': build, 'bdist': bdist}
if have_wheel:
commands['bdist_wheel'] = bdist_wheel

Expand Down
2 changes: 1 addition & 1 deletion python/src/addons/Index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

self.inst.get().Delete(key)

def get (self, key, default = None):
def Get (self, key, default = None):
if isinstance(key, unicode):
key = key.encode('utf-8')
assert isinstance(key, bytes), 'arg in_0 wrong type'
Expand Down
20 changes: 1 addition & 19 deletions python/tests/index/merger_binary_test.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
# -*- coding: utf-8 -*-
# Usage: py.test tests

import keyvi._pycore
from keyvi._core import get_package_root, get_interpreter_executable

import os.path
import subprocess
import sys


def get_package_root():
module_location = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(keyvi._pycore.__file__)), ".."))

if (sys.version_info.major >= 3):
module_location = module_location.encode('utf-8')

return module_location


def get_interpreter_executable():
executable = sys.executable

if (sys.version_info.major >= 3):
executable = executable.encode('utf-8')

return executable


def test_merger_binary():
cmd = get_interpreter_executable() + b" " + os.path.join(get_package_root(), b"_pycore" , b"keyvimerger.py") + b" -h"
rc = subprocess.call(cmd, shell=True)
Expand Down

0 comments on commit bd14fe5

Please sign in to comment.