Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package libqfieldsync as wheel #526

Merged
merged 11 commits into from
Nov 19, 2023
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 .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /tmp/
RUN pip3 install --upgrade pip
RUN pip3 install -r /tmp/requirements.txt

ENV LANG=C.UTF-8
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
qgis_version: [release-3_22, release-3_28, latest]
qgis_version: [release-3_22, latest]
env:
QGIS_TEST_VERSION: ${{ matrix.qgis_version }}
steps:
Expand All @@ -68,8 +68,11 @@ jobs:

sudo apt update
sudo apt install qgis
sudo pip3 install --upgrade pip
sudo pip3 install pytest nose2 mock

pip3 install -r requirements.txt

xvfb-run pytest

release:
Expand All @@ -90,6 +93,10 @@ jobs:
run: |
sudo apt update && sudo apt install qtbase5-dev qttools5-dev-tools
sudo pip install qgis-plugin-ci
- name: Package libqfieldsync
run: |
pip wheel $(grep -o -P '(https://.*.tar.gz)' requirements.txt)
m-kuhn marked this conversation as resolved.
Show resolved Hide resolved
mv libqfieldsync-*.whl qfieldsync/libqfieldsync.whl
- name: Release
run: |
RELEASE_VERSION=${GITHUB_REF##*/}
Expand All @@ -99,7 +106,8 @@ jobs:
--transifex-token ${TX_TOKEN} \
--github-token ${GITHUB_TOKEN} \
--osgeo-username ${OSGEO_USERNAME} \
--osgeo-password ${OSGEO_PASSWORD}
--osgeo-password ${OSGEO_PASSWORD} \
--asset-path qfieldsync/libqfieldsync.whl

package:
runs-on: ubuntu-22.04
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,5 @@ qfieldsync/resources_rc.py

.vscode/**
.qt_for_python/**

qfieldsync/libqfieldsync.whl
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "qfieldsync/setting_manager"]
path = qfieldsync/setting_manager
url = https://github.com/opengisch/qgissettingmanager.git
[submodule "qfieldsync/libqfieldsync"]
path = qfieldsync/libqfieldsync
url = https://github.com/opengisch/libqfieldsync.git
10 changes: 9 additions & 1 deletion qfieldsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/***************************************************************************
QFieldSync
A QGIS plugin
Sync your projects to QField
Sync your projects to QField on android
-------------------
begin : 2015-05-20
copyright : (C) 2015 by OPENGIS.ch
Expand All @@ -25,9 +25,17 @@
from __future__ import absolute_import

import os
import pathlib
import sys

import qgis.utils

src_dir = pathlib.Path(__file__).parent.resolve()

libqfieldsync_whl = src_dir / "libqfieldsync.whl"
m-kuhn marked this conversation as resolved.
Show resolved Hide resolved
if libqfieldsync_whl.exists():
sys.path.append(str(libqfieldsync_whl))


# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
Expand Down
9 changes: 3 additions & 6 deletions qfieldsync/core/cloud_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@

from pathlib import Path

from libqfieldsync.layer import LayerSource
from libqfieldsync.utils.file_utils import copy_attachments
from libqfieldsync.utils.qgis import get_qgis_files_within_dir, make_temp_qgis_file
from qgis.core import QgsMapLayer, QgsProject, QgsVirtualLayerDefinition
from qgis.PyQt.QtCore import QCoreApplication, QObject, QUrl, pyqtSignal
from qgis.utils import iface

from qfieldsync.core.preferences import Preferences
from qfieldsync.libqfieldsync.layer import LayerSource
from qfieldsync.libqfieldsync.utils.file_utils import copy_attachments
from qfieldsync.libqfieldsync.utils.qgis import (
get_qgis_files_within_dir,
make_temp_qgis_file,
)
from qfieldsync.utils.qgis_utils import open_project


Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/core/cloud_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
from pathlib import Path
from typing import Any, Dict, Iterator, List, Optional

from libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qgis.core import QgsProject
from qgis.PyQt.QtCore import QDir

from qfieldsync.core.preferences import Preferences
from qfieldsync.libqfieldsync.utils.qgis import get_qgis_files_within_dir


class ProjectFileCheckout(IntFlag):
Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/core/cloud_transferrer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pathlib import Path
from typing import Any, Dict, List, Optional

from libqfieldsync.utils.file_utils import copy_multifile
from qgis.core import Qgis, QgsMessageLog
from qgis.PyQt.QtCore import (
QAbstractListModel,
Expand All @@ -38,7 +39,6 @@

from qfieldsync.core.cloud_api import CloudNetworkAccessManager
from qfieldsync.core.cloud_project import CloudProject, ProjectFile, ProjectFileCheckout
from qfieldsync.libqfieldsync.utils.file_utils import copy_multifile


class CloudTransferrer(QObject):
Expand Down
3 changes: 1 addition & 2 deletions qfieldsync/gui/checker_feedback_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
***************************************************************************/
"""

from libqfieldsync.project_checker import ProjectCheckerFeedback
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QLabel, QTableWidget, QTableWidgetItem

from qfieldsync.libqfieldsync.project_checker import ProjectCheckerFeedback


class CheckerFeedbackTable(QTableWidget):
def __init__(self, checker_feedback: ProjectCheckerFeedback, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/gui/cloud_browser_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pathlib import Path
from typing import List

from libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qgis.core import (
QgsDataCollectionItem,
QgsDataItem,
Expand All @@ -40,7 +41,6 @@
from qfieldsync.gui.cloud_login_dialog import CloudLoginDialog
from qfieldsync.gui.cloud_projects_dialog import CloudProjectsDialog
from qfieldsync.gui.cloud_transfer_dialog import CloudTransferDialog
from qfieldsync.libqfieldsync.utils.qgis import get_qgis_files_within_dir


class QFieldCloudItemProvider(QgsDataItemProvider):
Expand Down
9 changes: 3 additions & 6 deletions qfieldsync/gui/cloud_create_project_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
from pathlib import Path
from typing import Optional

from libqfieldsync.layer import LayerSource
from libqfieldsync.utils.file_utils import fileparts, get_unique_empty_dirname
from libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qgis.core import Qgis, QgsApplication, QgsProject
from qgis.gui import QgisInterface
from qgis.PyQt.QtCore import QDir, QRegularExpression, Qt, QTimer, QUrl, pyqtSignal
Expand All @@ -45,12 +48,6 @@
from qfieldsync.core.cloud_transferrer import CloudTransferrer
from qfieldsync.core.preferences import Preferences
from qfieldsync.gui.cloud_login_dialog import CloudLoginDialog
from qfieldsync.libqfieldsync.layer import LayerSource
from qfieldsync.libqfieldsync.utils.file_utils import (
fileparts,
get_unique_empty_dirname,
)
from qfieldsync.libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qfieldsync.utils.cloud_utils import (
LocalDirFeedback,
local_dir_feedback,
Expand Down
8 changes: 4 additions & 4 deletions qfieldsync/gui/cloud_transfer_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
from pathlib import Path
from typing import Callable, Dict, List

from libqfieldsync.offline_converter import ExportType
from libqfieldsync.project_checker import ProjectChecker
from libqfieldsync.utils.file_utils import get_unique_empty_dirname
from libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qgis.core import QgsProject
from qgis.PyQt.QtCore import QDir, Qt, QUrl, pyqtSignal
from qgis.PyQt.QtGui import QDesktopServices, QShowEvent
Expand All @@ -48,10 +52,6 @@
from qfieldsync.core.cloud_transferrer import CloudTransferrer, TransferFileLogsModel
from qfieldsync.core.preferences import Preferences
from qfieldsync.gui.checker_feedback_table import CheckerFeedbackTable
from qfieldsync.libqfieldsync.offline_converter import ExportType
from qfieldsync.libqfieldsync.project_checker import ProjectChecker
from qfieldsync.libqfieldsync.utils.file_utils import get_unique_empty_dirname
from qfieldsync.libqfieldsync.utils.qgis import get_qgis_files_within_dir

from ..utils.qt_utils import make_folder_selector, make_icon, make_pixmap

Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/gui/layers_config_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
from typing import Callable

from libqfieldsync.layer import LayerSource, SyncAction
from PyQt5.QtWidgets import QPushButton
from qgis.core import Qgis, QgsMapLayerModel, QgsProject
from qgis.PyQt.QtCore import Qt
Expand All @@ -40,7 +41,6 @@

from qfieldsync.core.message_bus import message_bus
from qfieldsync.gui.utils import set_available_actions
from qfieldsync.libqfieldsync.layer import LayerSource, SyncAction

LayersConfigWidgetUi, _ = loadUiType(
os.path.join(os.path.dirname(__file__), "../ui/layers_config_widget.ui")
Expand Down
2 changes: 1 addition & 1 deletion qfieldsync/gui/map_layer_config_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""
import os

from libqfieldsync.layer import LayerSource
from qgis.core import QgsMapLayer, QgsProject
from qgis.gui import QgsMapLayerConfigWidget, QgsMapLayerConfigWidgetFactory
from qgis.PyQt.QtWidgets import QLabel
Expand All @@ -33,7 +34,6 @@
RelationshipConfigurationTableWidget,
)
from qfieldsync.gui.utils import set_available_actions
from qfieldsync.libqfieldsync.layer import LayerSource

WidgetUi, _ = loadUiType(
os.path.join(os.path.dirname(__file__), "../ui/map_layer_config_widget.ui")
Expand Down
11 changes: 6 additions & 5 deletions qfieldsync/gui/package_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"""
import os

from libqfieldsync.layer import LayerSource
from libqfieldsync.offline_converter import ExportType, OfflineConverter
from libqfieldsync.project import ProjectConfiguration
from libqfieldsync.project_checker import ProjectChecker
from libqfieldsync.utils.file_utils import fileparts
from libqfieldsync.utils.qgis import get_project_title
from qgis.core import Qgis, QgsApplication, QgsProject
from qgis.PyQt.QtCore import QDir, Qt, QUrl
from qgis.PyQt.QtGui import QIcon
Expand All @@ -32,11 +38,6 @@
from qfieldsync.gui.checker_feedback_table import CheckerFeedbackTable
from qfieldsync.gui.dirs_to_copy_widget import DirsToCopyWidget
from qfieldsync.gui.project_configuration_dialog import ProjectConfigurationDialog
from qfieldsync.libqfieldsync import LayerSource, OfflineConverter, ProjectConfiguration
from qfieldsync.libqfieldsync.offline_converter import ExportType
from qfieldsync.libqfieldsync.project_checker import ProjectChecker
from qfieldsync.libqfieldsync.utils.file_utils import fileparts
from qfieldsync.libqfieldsync.utils.qgis import get_project_title

from ..utils.qt_utils import make_folder_selector

Expand Down
8 changes: 2 additions & 6 deletions qfieldsync/gui/project_configuration_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"""
import os

from libqfieldsync.layer import LayerSource, SyncAction
from libqfieldsync.project import ProjectConfiguration, ProjectProperties
from qgis.core import (
QgsCoordinateReferenceSystem,
QgsMapLayerProxyModel,
Expand All @@ -34,12 +36,6 @@

from qfieldsync.core.preferences import Preferences
from qfieldsync.gui.layers_config_widget import LayersConfigWidget
from qfieldsync.libqfieldsync import (
LayerSource,
ProjectConfiguration,
ProjectProperties,
SyncAction,
)

WidgetUi, _ = loadUiType(
os.path.join(os.path.dirname(__file__), "../ui/project_configuration_widget.ui"),
Expand Down
16 changes: 8 additions & 8 deletions qfieldsync/gui/synchronize_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
import os
from pathlib import Path

from libqfieldsync.project import ProjectConfiguration
from libqfieldsync.utils.exceptions import NoProjectFoundError
from libqfieldsync.utils.file_utils import (
copy_attachments,
get_project_in_folder,
import_file_checksum,
)
from libqfieldsync.utils.qgis import make_temp_qgis_file, open_project
from qgis.core import QgsProject
from qgis.PyQt.QtCore import QDir
from qgis.PyQt.QtWidgets import QDialog, QDialogButtonBox, QMessageBox
from qgis.PyQt.uic import loadUiType

from qfieldsync.core.preferences import Preferences
from qfieldsync.gui.dirs_to_copy_widget import DirsToCopyWidget
from qfieldsync.libqfieldsync import ProjectConfiguration
from qfieldsync.libqfieldsync.utils.exceptions import NoProjectFoundError
from qfieldsync.libqfieldsync.utils.file_utils import (
copy_attachments,
get_project_in_folder,
import_file_checksum,
)
from qfieldsync.libqfieldsync.utils.qgis import make_temp_qgis_file, open_project
from qfieldsync.utils.qgis_utils import import_checksums_of_project
from qfieldsync.utils.qt_utils import make_folder_selector

Expand Down
1 change: 0 additions & 1 deletion qfieldsync/libqfieldsync
Submodule libqfieldsync deleted from 1ad645
3 changes: 1 addition & 2 deletions qfieldsync/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
from pathlib import Path
from typing import List

from libqfieldsync.offline_converter import ExportType, OfflineConverter
from qgis.core import Qgis, QgsOfflineEditing, QgsProject
from qgis.testing import start_app, unittest
from qgis.testing.mocked import get_iface

from qfieldsync.libqfieldsync.offline_converter import ExportType, OfflineConverter

start_app()


Expand Down
3 changes: 1 addition & 2 deletions qfieldsync/utils/cloud_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
from pathlib import Path
from typing import Tuple

from libqfieldsync.utils.qgis import get_qgis_files_within_dir
from qgis.PyQt.QtCore import QObject

from qfieldsync.libqfieldsync.utils.qgis import get_qgis_files_within_dir


class LocalDirFeedback(Enum):
Error = "error"
Expand Down
7 changes: 3 additions & 4 deletions qfieldsync/utils/qgis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@

from typing import List

from libqfieldsync.project import ProjectConfiguration
from libqfieldsync.utils.file_utils import get_project_in_folder
from libqfieldsync.utils.qgis import open_project
from qgis.core import QgsProject

from qfieldsync.libqfieldsync import ProjectConfiguration
from qfieldsync.libqfieldsync.utils.file_utils import get_project_in_folder
from qfieldsync.libqfieldsync.utils.qgis import open_project


def import_checksums_of_project(dirname: str) -> List[str]:
project = QgsProject.instance()
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ flake8-respect-noqa
pytest
future
transifex-client

# TODO: point to a commit on master after merging https://github.com/opengisch/libqfieldsync/pull/49
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open todo ...

libqfieldsync @ https://github.com/opengisch/libqfieldsync/archive/master.tar.gz
Loading