Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name = "pypi"

[packages]
python-dateutil = "==2.6.0"
pygeodiff = "==0.3.0"


[dev-packages]
Expand Down
68 changes: 38 additions & 30 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ For using mergin client with its dependencies packaged locally run:
mkdir -p mergin/deps
pip wheel -r mergin_client.egg-info/requires.txt -w mergin/deps

Build and add [geodiff](https://github.com/lutraconsulting/geodiff) lib (libgeodiff.so) and pygeodiff wheel to mergin/deps.

## Tests
For running test do:
Expand Down
8 changes: 1 addition & 7 deletions mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .utils import save_to_file, generate_checksum, move_file, DateTimeEncoder, int_version, find

this_dir = os.path.dirname(os.path.realpath(__file__))
GEODIFFLIB = os.path.join(os.path.dirname(os.path.realpath(__file__)), "deps/libgeodiff.so")

try:
import dateutil.parser
Expand Down Expand Up @@ -60,13 +59,8 @@ def __init__(self, directory):
self.dir = os.path.abspath(directory)
if not os.path.exists(self.dir):
raise InvalidProject('Project directory does not exist')

try:
lib = os.environ.get("GEODIFFLIB", GEODIFFLIB)
self.geodiff = pygeodiff.GeoDiff(lib)
except OSError:
self.geodiff = None

self.geodiff = pygeodiff.GeoDiff() if os.environ.get('GEODIFF_ENABLED', 'True').lower() == 'true' else None
self.meta_dir = os.path.join(self.dir, '.mergin')
if not os.path.exists(self.meta_dir):
os.mkdir(self.meta_dir)
Expand Down
6 changes: 1 addition & 5 deletions mergin/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
USER_PWD = os.environ.get('TEST_API_PASSWORD')
TMP_DIR = tempfile.gettempdir()
TEST_DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_data')
GEODIFFLIB = os.environ.get("GEODIFFLIB", '../deps/libgeodiff.so')


@pytest.fixture(scope='function')
Expand Down Expand Up @@ -197,10 +196,7 @@ def test_ignore_files(mc):
@pytest.mark.parametrize("diffs_limit, push_geodiff_enabled, pull_geodiff_enabled", diff_test_scenarios)
def test_sync_diff(mc, diffs_limit, push_geodiff_enabled, pull_geodiff_enabled):
def toggle_geodiff(enabled):
if enabled:
os.environ['GEODIFFLIB'] = GEODIFFLIB
else:
os.environ['GEODIFFLIB'] = 'libgeodiff' # invalid path causing failure
os.environ['GEODIFF_ENABLED'] = str(enabled)

test_project = f'test_sync_diff_{diffs_limit}_{int(push_geodiff_enabled)}_{int(pull_geodiff_enabled)}'
project = API_USER + '/' + test_project
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

platforms='any',
install_requires=[
'python-dateutil'
'python-dateutil==2.6.0',
'pygeodiff==0.3.0'
],

test_suite='nose.collector',
Expand Down