diff --git a/.gitignore b/.gitignore index 0d20b64..79062fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.pyc +AUTHORS +ChangeLog diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..c1f8fce --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +Edward Toroshchin Edward Hades diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e51767e..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Edward Toroshchin diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..5707e69 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include chuckchi/api/static * diff --git a/chukchi/api/static b/chukchi/api/static deleted file mode 120000 index 59b99aa..0000000 --- a/chukchi/api/static +++ /dev/null @@ -1 +0,0 @@ -../../htdocs \ No newline at end of file diff --git a/htdocs/css/bootstrap-responsive.min.css b/chukchi/api/static/css/bootstrap-responsive.min.css similarity index 100% rename from htdocs/css/bootstrap-responsive.min.css rename to chukchi/api/static/css/bootstrap-responsive.min.css diff --git a/htdocs/css/bootstrap.min.css b/chukchi/api/static/css/bootstrap.min.css similarity index 100% rename from htdocs/css/bootstrap.min.css rename to chukchi/api/static/css/bootstrap.min.css diff --git a/htdocs/css/style.css b/chukchi/api/static/css/style.css similarity index 100% rename from htdocs/css/style.css rename to chukchi/api/static/css/style.css diff --git a/htdocs/favicon.ico b/chukchi/api/static/favicon.ico similarity index 100% rename from htdocs/favicon.ico rename to chukchi/api/static/favicon.ico diff --git a/htdocs/favicon.png b/chukchi/api/static/favicon.png similarity index 100% rename from htdocs/favicon.png rename to chukchi/api/static/favicon.png diff --git a/htdocs/img/glyphicons-halflings-white.png b/chukchi/api/static/img/glyphicons-halflings-white.png similarity index 100% rename from htdocs/img/glyphicons-halflings-white.png rename to chukchi/api/static/img/glyphicons-halflings-white.png diff --git a/htdocs/img/glyphicons-halflings.png b/chukchi/api/static/img/glyphicons-halflings.png similarity index 100% rename from htdocs/img/glyphicons-halflings.png rename to chukchi/api/static/img/glyphicons-halflings.png diff --git a/htdocs/img/loader.gif b/chukchi/api/static/img/loader.gif similarity index 100% rename from htdocs/img/loader.gif rename to chukchi/api/static/img/loader.gif diff --git a/htdocs/img/openid.png b/chukchi/api/static/img/openid.png similarity index 100% rename from htdocs/img/openid.png rename to chukchi/api/static/img/openid.png diff --git a/htdocs/index.html b/chukchi/api/static/index.html similarity index 100% rename from htdocs/index.html rename to chukchi/api/static/index.html diff --git a/htdocs/js/bootstrap.min.js b/chukchi/api/static/js/bootstrap.min.js similarity index 100% rename from htdocs/js/bootstrap.min.js rename to chukchi/api/static/js/bootstrap.min.js diff --git a/htdocs/js/chukchi.js b/chukchi/api/static/js/chukchi.js similarity index 100% rename from htdocs/js/chukchi.js rename to chukchi/api/static/js/chukchi.js diff --git a/htdocs/js/chukchiui.js b/chukchi/api/static/js/chukchiui.js similarity index 100% rename from htdocs/js/chukchiui.js rename to chukchi/api/static/js/chukchiui.js diff --git a/htdocs/js/jquery.cookie.js b/chukchi/api/static/js/jquery.cookie.js similarity index 100% rename from htdocs/js/jquery.cookie.js rename to chukchi/api/static/js/jquery.cookie.js diff --git a/htdocs/js/jquery.min.js b/chukchi/api/static/js/jquery.min.js similarity index 100% rename from htdocs/js/jquery.min.js rename to chukchi/api/static/js/jquery.min.js diff --git a/htdocs/js/json2.js b/chukchi/api/static/js/json2.js similarity index 100% rename from htdocs/js/json2.js rename to chukchi/api/static/js/json2.js diff --git a/htdocs/js/moment.min.js b/chukchi/api/static/js/moment.min.js similarity index 100% rename from htdocs/js/moment.min.js rename to chukchi/api/static/js/moment.min.js diff --git a/chukchi/cmd.py b/chukchi/cmd.py new file mode 100644 index 0000000..678f747 --- /dev/null +++ b/chukchi/cmd.py @@ -0,0 +1,49 @@ +import logging +import sys + +def run(): + from chukchi.api import app + print __file__ + print sys.modules['chukchi'].__file__ + logging.basicConfig(format="%(asctime)-15s %(name)s: %(message)s", + level=logging.DEBUG if app.debug else logging.INFO) + app.run(*sys.argv[1:]) + +def init_db(): + from chukchi.db import engine + from chukchi.db.models import Base + + Base.metadata.create_all(engine) + +def update_feeds(): + from datetime import timedelta + + from sqlalchemy.orm import scoped_session + + from chukchi.config import config + from chukchi.db import Session + from chukchi.db.models import Feed + from chukchi.feed.parse import update_feed + from chukchi.utils import now + + logging.basicConfig(level=logging.DEBUG if config.DEBUG else logging.INFO) + + LOG = logging.getLogger(__name__) + + db_search = Session() + db_update = scoped_session(Session) + + if config.SOCKET_TIMEOUT: + import socket + socket.setdefaulttimeout(config.SOCKET_TIMEOUT) + + for feed in db_search.query(Feed).filter( Feed.active == True, + Feed.retrieved_at <= (now() - timedelta(**config.UPDATE_DELAY)) ): + feed_repr = repr(feed) + try: + db_search.expunge(feed) + update_feed(db_update, feed=feed) + db_update.commit() + except Exception, e: + LOG.exception("failure updating feed %s", feed_repr) + db_update.remove() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..62d08a2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +Flask>=0.8 +Flask-OpenID>=1.1.1 +SQLAlchemy>=0.7.9 +feedparser>=5.1.2 +pytz diff --git a/scripts/__init__.py b/scripts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/init_db.py b/scripts/init_db.py deleted file mode 100644 index 5efdca4..0000000 --- a/scripts/init_db.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file is part of Chukchi, the free web-based RSS aggregator -# -# Copyright (C) 2013 Edward Toroshchin -# -# Chukchi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Chukchi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# Please see the file COPYING in the root directory of this project. -# If you are unable to locate this file, see . - -from chukchi.db import engine -from chukchi.db.models import Base - -Base.metadata.create_all(engine) - -# vi: sw=4:ts=4:et diff --git a/scripts/run.py b/scripts/run.py deleted file mode 100644 index 5e39f5f..0000000 --- a/scripts/run.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file is part of Chukchi, the free web-based RSS aggregator -# -# Copyright (C) 2013 Edward Toroshchin -# -# Chukchi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Chukchi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# Please see the file COPYING in the root directory of this project. -# If you are unable to locate this file, see . - -import logging -import sys - -from chukchi.api import app - -logging.basicConfig(format="%(asctime)-15s %(name)s: %(message)s", - level=logging.DEBUG if app.debug else logging.INFO) - -app.run(*sys.argv[1:]) - -# vi: sw=4:ts=4:et diff --git a/scripts/update_feeds.py b/scripts/update_feeds.py deleted file mode 100644 index 13fa019..0000000 --- a/scripts/update_feeds.py +++ /dev/null @@ -1,53 +0,0 @@ -# This file is part of Chukchi, the free web-based RSS aggregator -# -# Copyright (C) 2013 Edward Toroshchin -# -# Chukchi is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Chukchi is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# Please see the file COPYING in the root directory of this project. -# If you are unable to locate this file, see . - -import logging -import sys - -from datetime import timedelta - -from sqlalchemy.orm import scoped_session - -from chukchi.config import config -from chukchi.db import Session -from chukchi.db.models import Feed -from chukchi.feed.parse import update_feed -from chukchi.utils import now - -logging.basicConfig(level=logging.DEBUG if config.DEBUG else logging.INFO) - -LOG = logging.getLogger(__name__) - -db_search = Session() -db_update = scoped_session(Session) - -if config.SOCKET_TIMEOUT: - import socket - socket.setdefaulttimeout(config.SOCKET_TIMEOUT) - -for feed in db_search.query(Feed).filter( Feed.active == True, - Feed.retrieved_at <= (now() - timedelta(**config.UPDATE_DELAY)) ): - feed_repr = repr(feed) - try: - db_search.expunge(feed) - update_feed(db_update, feed=feed) - db_update.commit() - except Exception, e: - LOG.exception("failure updating feed %s", feed_repr) - db_update.remove() - -# vi: sw=4:ts=4:et diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2aa235f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,29 @@ +[metadata] +name = chukchi +summary = Chukchi is an RSS aggregation webapp +description-file = + README +author = Edward Toroshchin +author-email = chukchi-project@hades.name +classifier = + Development Status :: 3 - Alpha + Environment :: Web Environment + Framework :: Flask + License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) + Operating System :: OS Independent + Programming Language :: Python :: 2 :: Only + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[files] +packages = + chukchi +include_package_data = True + +[entry_points] +console_scripts = + chukchi-init-db = chukchi.cmd:init_db + chukchi-run = chukchi.cmd:run + chukchi-update-feeds = chukchi.cmd:update_feeds diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..dc2e65d --- /dev/null +++ b/setup.py @@ -0,0 +1,5 @@ +import setuptools + +setuptools.setup( + setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5,<0.6'], + d2to1=True)