-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move parsers into own python package. Using a dedicated folder for parsers makes the project structure more clear and simplifies to find stuff. In addition it makes it easier to identifier individual parsers and tools and infrastructure used by all parsers. Extend setup.py to used setuptools to find packages. Top modules are now listed manually. Travis build scripts and the urls that are tested are now grouped under `build_scripts`. The `parse` method is move `parse.py`. `config.py` simply defines which parsers exists. Many thanks to @y0hy0h for the time and effort of these changes.
- Loading branch information
Showing
32 changed files
with
54 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -ex | ||
apt-get update -qq | ||
apt-get install -qq python3 python3-setuptools python3-bs4 python3-lxml uwsgi uwsgi-plugin-python3 devscripts debhelper |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
|
||
from config import parse | ||
from utils import Request, NotFoundError | ||
from config import parsers | ||
from utils import Request, NotFoundError, ParserNotFound | ||
|
||
|
||
def parse(request, parser_name, *args): | ||
if parser_name in parsers: | ||
return parsers[parser_name].parse(request, *args) | ||
else: | ||
raise ParserNotFound(parser_name) | ||
|
||
|
||
class SimulatedRequest(Request): | ||
def __init__(self): | ||
self.host = 'http://example.org' | ||
|
||
|
||
try: | ||
print(parse(SimulatedRequest(), *sys.argv[1:])) | ||
except NotFoundError as e: | ||
print(e) | ||
sys.exit(2) | ||
if __name__ == '__main__': | ||
try: | ||
print(parse(SimulatedRequest(), *sys.argv[1:])) | ||
except NotFoundError as e: | ||
print(e) | ||
sys.exit(2) |
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import os | ||
import glob | ||
from distutils.core import setup | ||
|
||
modules = list(map(lambda d: d[:-3], glob.glob(os.path.join('*.py')))) | ||
modules.remove('setup') | ||
from setuptools import find_packages | ||
|
||
setup(name="openmensa-parsers", | ||
version="1.0", | ||
description="A collection with parsers for openmensa", | ||
author="Malte Swart", | ||
author_email="mswart@devtation.de", | ||
url="https://github.com/mswart/openmensa-parsers.git", | ||
py_modules=modules + ['pyopenmensa/__init__', 'pyopenmensa/feed'], | ||
packages=find_packages(), | ||
py_modules=['config', 'utils', 'parse', 'wsgihandler', 'pyopenmensa/__init__', | ||
'pyopenmensa/feed'], | ||
requires=['beautifulsoup4', 'lxml']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters