Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hotosm/osm-fieldwork
Browse files Browse the repository at this point in the history
Sync with main.
  • Loading branch information
rsavoye committed Dec 8, 2023
2 parents a298a25 + fb52aa2 commit 39ff670
Show file tree
Hide file tree
Showing 15 changed files with 866 additions and 152 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

# Allow files and directories
!osm_fieldwork
!ui
!pyproject.toml
!pdm.lock
!entrypoint.sh
!README.md
!LICENSE
!LICENSE.md
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.1.5"
rev: "v0.1.6"
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.4.0 (2023-12-05)

### Feat

- basic kivy ui to download basemaps

### Fix

- Fix merge conflict
- Make sure ref exists before trying to use it from a dict
- Add default variables

## 0.3.8 (2023-11-18)

### Fix
Expand Down
83 changes: 79 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir pdm==2.6.1
RUN pdm export --prod > requirements.txt \
&& pdm export -G debug -G test -G docs \
--no-default > requirements-ci.txt
--no-default > requirements-ci.txt \
&& pdm export -G ui \
--no-default > requirements-ui.txt



FROM base as build-wheel
WORKDIR /build
COPY . .
RUN pip install pdm==2.6.1 \
&& pdm build
COPY pyproject.toml pdm.lock README.md LICENSE.md ./
COPY osm_fieldwork ./osm_fieldwork
RUN pip install pdm==2.6.1 && pdm build



Expand Down Expand Up @@ -115,6 +117,79 @@ COPY entrypoint.sh /container-entrypoint.sh



FROM runtime as ui-base
ARG PYTHON_IMG_TAG
COPY --from=extract-deps \
/opt/python/requirements-ui.txt /opt/python/
RUN mv /root/.local/bin/* /usr/local/bin/ \
&& mv /root/.local/lib/python${PYTHON_IMG_TAG}/site-packages/* \
/usr/local/lib/python${PYTHON_IMG_TAG}/site-packages/ \
&& set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
-y --no-install-recommends \
"git" \
"xclip" \
"libmtdev-dev" \
"libgl-dev" \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --upgrade --no-warn-script-location \
--no-cache-dir -r \
/opt/python/requirements-ui.txt \
# Add flask, required for webdebugger
&& pip install --upgrade --no-warn-script-location \
--no-cache-dir flask==3.0.0 \
&& rm -r /opt/python
WORKDIR /app
COPY ui/main.py ui/osmfieldwork.kv ui/buildozer.spec ./
# Update the requirements in buildozer.spec
RUN requirements_list=$(grep -v '^#' requirements-ci.txt \
| tr '\n' ',' | sed 's/^,//; s/,$//') \
&& sed -e "/^requirements =/c\requirements = $requirements_list" \
buildozer.spec > temp_file.txt \
&& mv temp_file.txt buildozer.spec



FROM ui-base as ui-debug
# Default app storage dir
VOLUME ["/root/.config/osmfieldwork"]
VOLUME ["/tmp/.X11-unix"]
CMD ["python", "main.py", "-m", "webdebugger"]



FROM ui-base as ui-build
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
-y --no-install-recommends \
"build-essential" \
"automake" \
"ant" \
"cmake" \
"zip" \
"unzip" \
"openjdk-17-jdk" \
"autoconf" \
"libtool" \
"patch" \
"pkg-config" \
"zlib1g-dev" \
"libncurses5-dev" \
"libncursesw5-dev" \
"libtinfo5" \
"libffi-dev" \
"libssl-dev" \
"libltdl-dev" \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --user --no-warn-script-location \
--no-cache-dir buildozer==1.5.0 \
Cython==0.29.33 virtualenv==20.24.7
CMD ["buildozer", "android", "release"]



FROM runtime as ci
ARG PYTHON_IMG_TAG
COPY --from=extract-deps \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

PACKAGE := org.osm_fieldwork.py
NAME := osm-fieldwork
VERSION := 0.3.8
VERSION := 0.4.0

# All python source files
FILES := $(wildcard ./osm_fieldwork/*.py)
Expand Down
2 changes: 1 addition & 1 deletion osm_fieldwork/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.8"
__version__ = "0.4.0"
2 changes: 1 addition & 1 deletion osm_fieldwork/osmfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def createWay(
line += "%s=%r " % (ref, str(value))
osm += " <way " + line + ">"

if 'refs' in way:
if "refs" in way:
for ref in way["refs"]:
osm += '\n <nd ref="%s"/>' % ref
if "tags" in way:
Expand Down
Loading

0 comments on commit 39ff670

Please sign in to comment.