Commit cc5523ac authored by Jan Čermák's avatar Jan Čermák

refactoring: install via setup.py

parent ee14f3f6
*.pyc
*.sassc
*.scssc
*.mo
static/.sass-cache/*
static/css/*
static/js/*.min.js
templates/_layout.tpl
\ No newline at end of file
foris/static/css/*
foris/static/js/*.min.js
foris/templates/_layout.tpl
......@@ -14,21 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
COMPILED_CSS = $(wildcard static/css/*)
COMPILED_CSS = $(wildcard foris/static/css/*)
COMPILED_L10N = $(wildcard locale/*/LC_MESSAGES/*.mo)
COMPILED_L10N = $(wildcard foris/locale/*/LC_MESSAGES/*.mo)
JS_FILES = $(filter-out %.min.js $(wildcard static/js/contrib/*),$(wildcard \
static/js/*.js \
static/js/**/*.js \
JS_FILES = $(filter-out %.min.js $(wildcard foris/static/js/contrib/*),$(wildcard \
foris/static/js/*.js \
foris/static/js/**/*.js \
))
JS_MINIFIED = $(JS_FILES:.js=.min.js)
PRE_TPL_FILES = $(wildcard \
templates/*.pre.tpl \
templates/**/*.pre.tpl \
foris/templates/*.pre.tpl \
foris/templates/**/*.pre.tpl \
)
TPL_FILES = $(PRE_TPL_FILES:.pre.tpl=.tpl)
......@@ -48,7 +48,7 @@ preprocess-tpl: $(PRE_TPL_FILES) $(TPL_FILES)
# target: compile-sass - Compile SASS files to CSS files using SASS/Compass compiler.
compile-sass:
@cd static/; \
@cd foris/static/; \
echo '-- Running compass $<';\
$(SASS_COMPILER)
@echo
......@@ -76,4 +76,4 @@ clean:
# target: help - Show this help.
help:
@egrep "^# target:" Makefile
\ No newline at end of file
@egrep "^# target:" Makefile
......@@ -27,14 +27,14 @@ from bottle_i18n import I18NMiddleware, I18NPlugin, i18n_defaults
from ncclient.operations import TimeoutExpiredError, RPCError
# local
from nuci import client, filters
from nuci.modules.uci_raw import Uci, Config, Section, Option
from nuci.modules.user_notify import Severity
from utils import redirect_unauthenticated, is_safe_redirect, is_user_authenticated
from utils.bottle_csrf import get_csrf_token, update_csrf_token, CSRFValidationError, CSRFPlugin
from utils import messages
from utils.reporting_middleware import ReportingMiddleware
from utils.routing import reverse
from .nuci import client, filters
from .nuci.modules.uci_raw import Uci, Config, Section, Option
from .nuci.modules.user_notify import Severity
from .utils import redirect_unauthenticated, is_safe_redirect, is_user_authenticated
from .utils.bottle_csrf import get_csrf_token, update_csrf_token, CSRFValidationError, CSRFPlugin
from .utils import messages
from .utils.reporting_middleware import ReportingMiddleware
from .utils.routing import reverse
logger = logging.getLogger("foris")
......@@ -386,19 +386,3 @@ def prepare_main_app(args):
app = SessionMiddleware(app, session_options)
return app
# ---------------------------------------------------------------------------- #
# MAIN #
# ---------------------------------------------------------------------------- #
if __name__ == "__main__":
parser = get_arg_parser()
args = parser.parse_args()
main_app = prepare_main_app(args)
# run the right server
if args.server == "wsgiref":
bottle.run(app=main_app, host=args.host, port=args.port, debug=args.debug)
elif args.server == "flup":
# bindAddress is None - FCGI process must be spawned by the server
bottle.run(app=main_app, server="flup", debug=args.debug, bindAddress=None)
import bottle
from foris import get_arg_parser, prepare_main_app
def main():
parser = get_arg_parser()
args = parser.parse_args()
main_app = prepare_main_app(args)
# run the right server
if args.server == "wsgiref":
bottle.run(app=main_app, host=args.host, port=args.port, debug=args.debug)
elif args.server == "flup":
# bindAddress is None - FCGI process must be spawned by the server
bottle.run(app=main_app, server="flup", debug=args.debug, bindAddress=None)
if __name__ == "__main__":
main()
......@@ -23,15 +23,15 @@ from urlparse import urlunsplit
from bottle import Bottle, request, template
import bottle
from config_handlers import *
from .config_handlers import *
from foris import gettext_dummy as gettext, make_notification_title, ugettext as _
from nuci import client
from nuci.client import filters
from nuci.exceptions import ConfigRestoreError
from utils import login_required
from utils import messages
from utils.bottle_csrf import CSRFPlugin
from utils.routing import reverse
from .nuci import client
from .nuci.client import filters
from .nuci.exceptions import ConfigRestoreError
from .utils import login_required
from .utils import messages
from .utils.bottle_csrf import CSRFPlugin
from .utils.routing import reverse
logger = logging.getLogger(__name__)
......
......@@ -19,13 +19,13 @@ import re
import bottle
from foris import gettext_dummy as gettext, ugettext as _
from form import File, Password, Textbox, Dropdown, Checkbox, Hidden, Radio, Number, Email, Time, \
from foris.form import File, Password, Textbox, Dropdown, Checkbox, Hidden, Radio, Number, Email, Time, \
MultiCheckbox
import fapi
from nuci import client, filters
from nuci.filters import create_config_filter
from nuci.modules.uci_raw import Uci, Config, Section, Option, List, Value, parse_uci_bool
import validators
from foris import fapi
from foris.nuci import client, filters
from foris.nuci.filters import create_config_filter
from foris.nuci.modules.uci_raw import Uci, Config, Section, Option, List, Value, parse_uci_bool
from foris import validators
logger = logging.getLogger(__name__)
......
......@@ -24,13 +24,12 @@ from ncclient.manager import OpExecutor, CAPABILITIES
from ncclient.operations import RPCError
from ncclient.operations.errors import TimeoutExpiredError
from modules import (maintain, network, password as password_module, registration,
time as time_module, uci_raw, updater, user_notify)
from modules.base import Data, YinElement
from nuci import filters
from nuci.exceptions import ConfigRestoreError
from nuci.modules import stats
from . import filters
from .exceptions import ConfigRestoreError
from .modules import (maintain, network, password as password_module, registration,
stats, time as time_module, uci_raw, updater, user_notify)
from .modules.base import Data, YinElement
logger = logging.getLogger("nuci.client")
......
......@@ -18,10 +18,12 @@
This module contains filters used for subtree filtering in nuci client. Filter is basically
an XML element that is passed to client.get() function and appropriate subtree is returned.
"""
from __future__ import absolute_import
from nuci.modules import stats, time, uci_raw, updater, user_notify
import xml.etree.cElementTree as ET
from .modules import stats, time, uci_raw, updater, user_notify
# top-level containers
uci = ET.Element(uci_raw.Uci.qual_tag(uci_raw.Uci.tag))
......
......@@ -14,9 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from base import YinElement
from xml.etree import cElementTree as ET
from .base import YinElement
class Maintain(YinElement):
tag = "maintain"
......@@ -82,4 +83,4 @@ class Maintain(YinElement):
return None
####################################################################################################
ET.register_namespace("maintain", Maintain.NS_URI)
\ No newline at end of file
ET.register_namespace("maintain", Maintain.NS_URI)
......@@ -16,7 +16,8 @@
from base import YinElement
from xml.etree import cElementTree as ET
from nuci.utils import unqualify
from foris.nuci.utils import unqualify
class Connection(YinElement):
......@@ -41,4 +42,4 @@ class Connection(YinElement):
return ET.Element(get_tag)
####################################################################################################
ET.register_namespace("network", Connection.NS_URI)
\ No newline at end of file
ET.register_namespace("network", Connection.NS_URI)
......@@ -15,9 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime, timedelta
from base import YinElement
from xml.etree import cElementTree as ET
from nuci.utils import unqualify
from .base import YinElement
from ..utils import unqualify
class Stats(YinElement):
......
......@@ -17,7 +17,7 @@ from datetime import datetime
from bottle import html_escape
from base import YinElement
from .base import YinElement
from xml.etree import cElementTree as ET
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment