Skip to content

Commit

Permalink
Merge pull request #233 from UAlbanyArchives/develop
Browse files Browse the repository at this point in the history
now detects mbox files without extentions from Mac Mail
  • Loading branch information
gwiedeman authored Jun 15, 2023
2 parents dac26b5 + 7532976 commit 72eeac8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ENV TZ=America/New_York \
MAILBAGIT_LOG_LEVEL=debug\
IN_CONTAINER=true

RUN mkdir /mailbagit
WORKDIR /mailbagit
ADD . /mailbagit/
#RUN mkdir /mailbagit
#WORKDIR /mailbagit
#ADD . /mailbagit/

# manually add to $PYTHONPATH because https://github.com/python/importlib_metadata/issues/364
ENV PYTHONPATH=/mailbagit
Expand All @@ -32,5 +32,3 @@ RUN apt-get install -y /tmp/google-chrome-stable_current_amd64.deb
RUN curl -L -o /tmp/wkhtmltox_0.12.6-1.buster_amd64.deb \
https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
RUN dpkg -i /tmp/wkhtmltox_0.12.6-1.buster_amd64.deb

RUN pip install -e .[pst]
13 changes: 13 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.1'

services:
mailbagit:
image: ualbanyarchives/mailbagit:dev
volumes:
- '../sampleData:/data'
- '.:/mailbagit'
tty: true
stdin_open: true
restart: always
working_dir: /mailbagit
entrypoint: /bin/bash
7 changes: 4 additions & 3 deletions docs/installing_mailbagit/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ docker compose run mailbag

## Run with bind mount.

You can also use a bind mount to give the container and `mailbagit` access to the files you want to process.
You can also use a bind mount to give the container and `mailbagit` access to another directory.

Mailbagit will have access to the directory listed in the `source=` argument, which will be accessible in the container using the `/data` path.

Expand Down Expand Up @@ -79,11 +79,12 @@ Remember to stop the container when you're done!

## Development Docker image

There is also a development image available:
There is also a development image available. This contains an consistent environment for mailbagit, but allows you to work directly with local code. Mounts a directory with test email data at `../sampleData` to `/data`.

```
docker pull ualbanyarchives/mailbagit:dev
docker run -it ualbanyarchives/mailbagit:dev
docker compose -f docker-compose-dev.yml run mailbagit
pip install -e .[pst]
```

### Other helpful docker commands
Expand Down
2 changes: 1 addition & 1 deletion mailbagit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# __init__.py

# Version of the mailbagit package
__version__ = "0.5.0"
__version__ = "0.5.1"

import os
from pathlib import Path
Expand Down
3 changes: 2 additions & 1 deletion mailbagit/formats/mbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def messages(self, iteration_only=False):
fileRoot = root + os.sep
# don't count the newly-created mailbag
if not fileRoot.startswith(mailbag_path):
if file.lower().endswith("." + self.format_name):
# Mac Mail export file is "mbox" without an extension, so this checks that
if file.lower().endswith("." + self.format_name) or file.lower().strip() == "mbox":
fileList.append(os.path.join(root, file))
elif self.companion_files:
companion_files.append(os.path.join(root, file))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="mailbagit",
version="0.5.0",
version="0.5.1",
author="Gregory Wiedeman",
author_email="[email protected]",
description="A tool for preserving email with multiple masters.",
Expand Down

0 comments on commit 72eeac8

Please sign in to comment.