diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9244cde..a67e9d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,17 @@ before_script: - "pip install -r requirements.txt" - "pip install pylint" - - "curl -sL https://deb.nodesource.com/setup_6.x | bash -" + - "curl -sL https://deb.nodesource.com/setup_10.x | bash -" - "apt-get install -y nodejs jq" - "npm install" -lint:2.7: - image: "python:2.7" - stage: "test" - script: - - "hooks/pre-commit" - -lint:3: +lint: image: "python:3" stage: "test" script: - "hooks/pre-commit" -test:2.7: - image: "python:2.7" - stage: "test" - script: - - python -m flatisfy init-config | jq '.constraints.default.house_types = ["APART"] | .constraints.default.type = "RENT" | .constraints.default.postal_codes = ["75014"]' > /tmp/config.json - - python -m flatisfy test --config /tmp/config.json -test:3: +test: image: "python:3" stage: "test" script: diff --git a/docker/Dockerfile b/docker/Dockerfile index f85baf4..601f4bd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:2 +FROM python:3 MAINTAINER Phyks # Setup layout. @@ -12,10 +12,10 @@ RUN apt-get update && \ # Install latest pip and python dependencies. RUN pip install -U setuptools && \ - pip install html2text simplejson BeautifulSoup + pip install html2text simplejson beautifulsoup4 # Install node.js. -RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get install -y nodejs # Install weboob's code itself. @@ -30,11 +30,11 @@ COPY ./*.sh /home/user/ # Install Flatisfy, set up directories and permissions. RUN cd /home/user \ - && git clone https://framagit.org/phyks/Flatisfy/ ./app \ + && git clone https://framagit.org/phyks/Flatisfy.git/ ./app \ && cd ./app \ && pip install -r requirements.txt \ && npm install \ - && npm run build:prod \ + && npm run build:dev \ && mkdir -p /home/user/.local/share/flatisfy \ && chown user:user -R /home/user \ && chmod +x /home/user/*.sh diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..b038337 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3" +services: + app: + build: . + # image: phyks/flatisfy + environment: + - LOCAL_USER_ID=1000 + volumes: + - ./data:/flatisfy + ports: + - "8080:8080" diff --git a/flatisfy/data_files/__init__.py b/flatisfy/data_files/__init__.py index 4e848cf..8f2803b 100644 --- a/flatisfy/data_files/__init__.py +++ b/flatisfy/data_files/__init__.py @@ -16,10 +16,7 @@ from flatisfy.models.postal_code import PostalCode from flatisfy.models.public_transport import PublicTransport from flatisfy.tools import normalize_string -if sys.version_info >= (3, 0): - import csv -else: - from backports import csv +import csv LOGGER = logging.getLogger(__name__) diff --git a/requirements.txt b/requirements.txt index 794d850..da794c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,9 @@ alembic appdirs arrow -backports.csv; python_version < '3.0' bottle bottle-sqlalchemy canister -enum34; python_version < '3.4' -functools32; python_version < '3.2.3' future imagehash mapbox