Skip to content

Commit

Permalink
Added regex for readme acceptance on *nix
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Mar 3, 2023
1 parent 1a69927 commit 98c770f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions e4e_data_management/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import datetime as dt
import pickle
import re
from pathlib import Path
from shutil import copy2
from typing import Dict, List, Optional, Iterable

from typing import Dict, Iterable, List, Optional
import fnmatch
import appdirs

from e4e_data_management.data import Dataset, Mission
Expand Down Expand Up @@ -231,7 +232,10 @@ def push(self, path: Path) -> None:
raise RuntimeError('Files still in staging')

# Check that the README is present
readmes = list(self.active_dataset.root.glob('readme.*'))
readmes = [file
for file in list(self.active_dataset.root.glob('*'))
if re.match(fnmatch.translate('readme.*'), file.name, re.IGNORECASE)]

if len(readmes) == 0:
raise RuntimeError('Readme not found')
acceptable_exts = ['.md', '.docx']
Expand Down

0 comments on commit 98c770f

Please sign in to comment.