Merge remote-tracking branch 'fox/master'
This commit is contained in:
commit
e1254df431
3
TODO
3
TODO
@ -13,11 +13,10 @@ euscan
|
|||||||
|
|
||||||
### Command line interface
|
### Command line interface
|
||||||
|
|
||||||
- html and xml output
|
- html output
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
- Add a config file (/etc/euscan.conf, ~/.euscan.conf)
|
|
||||||
- Add a HTTP cache (configurable)
|
- Add a HTTP cache (configurable)
|
||||||
|
|
||||||
### Tests
|
### Tests
|
||||||
|
@ -230,7 +230,8 @@ def parse_args():
|
|||||||
def main():
|
def main():
|
||||||
"""Parse command line and execute all actions."""
|
"""Parse command line and execute all actions."""
|
||||||
CONFIG['nocolor'] = (
|
CONFIG['nocolor'] = (
|
||||||
settings["NOCOLOR"] in ('yes', 'true') or not isatty
|
CONFIG['nocolor'] or
|
||||||
|
(settings["NOCOLOR"] in ('yes', 'true') or not isatty)
|
||||||
)
|
)
|
||||||
if CONFIG['nocolor']:
|
if CONFIG['nocolor']:
|
||||||
pp.output.nocolor()
|
pp.output.nocolor()
|
||||||
|
@ -304,6 +304,8 @@ def process_emails(profiles, only_if_vlogs=False):
|
|||||||
if only_if_vlogs and not vlogs.count():
|
if only_if_vlogs and not vlogs.count():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
vlogs = vlogs.order_by("-datetime")
|
||||||
|
|
||||||
infos = get_user_fav_infos(user)
|
infos = get_user_fav_infos(user)
|
||||||
infos["user"] = user
|
infos["user"] = user
|
||||||
infos["vlogs"] = vlogs
|
infos["vlogs"] = vlogs
|
||||||
|
@ -1,50 +1,31 @@
|
|||||||
{% load djeuscan_helpers %}
|
{% load djeuscan_helpers %}{% load sub %}Hello {{ user }},
|
||||||
{% load sub %}
|
|
||||||
Hello {{ user }},
|
|
||||||
|
|
||||||
{% if vlogs %}euscan news:
|
{% if vlogs %}euscan news:
|
||||||
|
{% for vlog in vlogs %} * {{ vlog.package|ljust:"35" }} {{ vlog.version }} {% if vlog.vtype and not vlog.vtype|is_stable %}({{ vlog.vtype }}){% endif %}
|
||||||
{% for vlog in vlogs %}
|
{% endfor %}
|
||||||
* {{ vlog }} {% if vlog.vtype and not vlog.vtype|is_stable %}({{ vlog.vtype }}){% endif %} - {{ vlog.datetime }} {% endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
Summary:
|
Summary:
|
||||||
|
|
||||||
{% with categories|length as num_categories %}{% if num_categories %}
|
{% with categories|length as num_categories %}{% if num_categories %}
|
||||||
Watching {{ num_categories }} categor{{ num_categories|pluralize:"y,ies"}}
|
Watching {{ num_categories }} categor{{ num_categories|pluralize:"y,ies"}}: {{ categories_upstream }} upstream version{{ categories_upstream|pluralize:"s"}}
|
||||||
{{ categories_upstream }} new upstream version{{ categories_upstream|pluralize:"s"}}
|
{% if categories_upstream %}Hot categories:
|
||||||
{% if categories_upstream %}
|
{% for c in categories|slice:":3" %} * {{ c.category }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})
|
||||||
Hot categories:
|
{% endfor %}
|
||||||
{% for c in categories|slice:":3" %}
|
{% endif %}{% endif %}{% endwith %}{% with herds|length as num_herds %}{% if num_herds %}
|
||||||
* {{ c.category }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }}){% endfor %}
|
Watching {{ num_herds }} herd{{ num_herds|pluralize:"s"}}: {{ herds_upstream }} upstream version{{ herds_upstream|pluralize:"s"}}
|
||||||
|
{% if herds_upstream %}Hot herds:
|
||||||
|
{% for c in herds|slice:":3" %} * {{ c.herds__herd }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}{% endif %}{% endwith %}{% with maintainers|length as num_maintainers %}{% if num_maintainers %}
|
||||||
|
Watching {{ num_maintainers }} maintainer{{ num_maintainers|pluralize:"s"}}: {{ maintainers_upstream }} upstream version{{ maintainers_upstream|pluralize:"s"}}
|
||||||
|
{% if maintainers_upstream %}Hot maintainers:
|
||||||
|
{% for c in maintainers|slice:":3" %} * {{ c.maintainers__name }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}{% endif %}{% endwith %}{% with packages|length as num_packages %}{% if num_packages %}
|
||||||
|
Watching {{ num_packages }} package{{ num_packages|pluralize:"s"}}: {{ packages_upstream }} upstream version{{ packages_upstream|pluralize:"s"}}
|
||||||
|
{% if packages_upstream %}Hot packages:
|
||||||
|
{% for c in packages|slice:":3" %} * {{ c }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})
|
||||||
|
{% endfor %}
|
||||||
{% endif %}{% endif %}{% endwith %}
|
{% endif %}{% endif %}{% endwith %}
|
||||||
|
|
||||||
{% with herds|length as num_herds %}{% if num_herds %}
|
|
||||||
Watching {{ num_herds }} herd{{ num_herds|pluralize:"s"}}
|
|
||||||
{{ herds_upstream }} new upstream version{{ herds_upstream|pluralize:"s"}}
|
|
||||||
{% if herds_upstream %}
|
|
||||||
Hot herds:
|
|
||||||
{% for c in herds|slice:":3" %}
|
|
||||||
* {{ c.herds__herd }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }}){% endfor %}
|
|
||||||
{% endif %}{% endif %}{% endwith %}
|
|
||||||
|
|
||||||
{% with maintainers|length as num_maintainers %}{% if num_maintainers %}
|
|
||||||
Watching {{ num_maintainers }} maintainer{{ num_maintainers|pluralize:"s"}}
|
|
||||||
{{ maintainers_upstream }} new upstream version{{ maintainers_upstream|pluralize:"s"}}
|
|
||||||
{% if maintainers_upstream %}
|
|
||||||
Hot maintainers:
|
|
||||||
{% for c in maintainers|slice:":3" %}
|
|
||||||
* {{ c.maintainers__name }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }}){% endfor %}
|
|
||||||
{% endif %}{% endif %}{% endwith %}
|
|
||||||
|
|
||||||
{% with packages|length as num_packages %}{% if num_packages %}
|
|
||||||
Watching {{ num_packages }} package{{ num_packages|pluralize:"s"}}
|
|
||||||
{{ packages_upstream }} new upstream version{{ packages_upstream|pluralize:"s"}}
|
|
||||||
{% if packages_upstream %}
|
|
||||||
Hot packages:
|
|
||||||
{% for c in packages|slice:":3" %}
|
|
||||||
* {{ c }} ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }}){% endfor %}
|
|
||||||
{% endif %}{% endif %}{% endwith %}
|
|
||||||
|
|
||||||
--
|
--
|
||||||
This email was sent by euscan
|
This email was sent by euscan, please do not reply.
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
__version__ = "git"
|
__version__ = "git"
|
||||||
|
|
||||||
|
import ConfigParser
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
'nocolor': False,
|
'nocolor': False,
|
||||||
'quiet': False,
|
'quiet': False,
|
||||||
@ -27,6 +31,13 @@ CONFIG = {
|
|||||||
'ebuild-uri': False,
|
'ebuild-uri': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config = ConfigParser.ConfigParser()
|
||||||
|
config.read(['/etc/euscan.conf', os.path.expanduser('~/.euscan.conf')])
|
||||||
|
if config.has_section("euscan"):
|
||||||
|
for key, value in config.items("euscan"):
|
||||||
|
if key in CONFIG:
|
||||||
|
CONFIG[key] = value
|
||||||
|
|
||||||
BLACKLIST_VERSIONS = [
|
BLACKLIST_VERSIONS = [
|
||||||
# Compatibility package for running binaries linked against a
|
# Compatibility package for running binaries linked against a
|
||||||
# pre gcc 3.4 libstdc++, won't be updated
|
# pre gcc 3.4 libstdc++, won't be updated
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import errno
|
import errno
|
||||||
import urllib2
|
import urllib2
|
||||||
|
from xml.dom.minidom import Document
|
||||||
|
|
||||||
import portage
|
import portage
|
||||||
from portage import dep
|
from portage import dep
|
||||||
@ -451,3 +452,33 @@ def parse_mirror(uri):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
return uri
|
return uri
|
||||||
|
|
||||||
|
|
||||||
|
def dict_to_xml(data, indent):
|
||||||
|
doc = Document()
|
||||||
|
root = doc.createElement("euscan")
|
||||||
|
doc.appendChild(root)
|
||||||
|
|
||||||
|
def _set_value(parent, value):
|
||||||
|
if isinstance(value, dict):
|
||||||
|
for k, v in value.iteritems():
|
||||||
|
node = doc.createElement(k)
|
||||||
|
_set_value(node, v)
|
||||||
|
parent.appendChild(node)
|
||||||
|
elif isinstance(value, list):
|
||||||
|
for item in value:
|
||||||
|
node = doc.createElement("value")
|
||||||
|
text = doc.createTextNode(item)
|
||||||
|
node.appendChild(text)
|
||||||
|
parent.appendChild(node)
|
||||||
|
else:
|
||||||
|
text = doc.createTextNode(unicode(value))
|
||||||
|
parent.appendChild(text)
|
||||||
|
|
||||||
|
for key, value in data.iteritems():
|
||||||
|
node = doc.createElement("package")
|
||||||
|
node.setAttribute("name", key)
|
||||||
|
_set_value(node, value)
|
||||||
|
root.appendChild(node)
|
||||||
|
|
||||||
|
return doc.toprettyxml(indent=" " * indent)
|
||||||
|
@ -10,6 +10,8 @@ import portage
|
|||||||
from portage.output import EOutput, TermProgressBar
|
from portage.output import EOutput, TermProgressBar
|
||||||
from gentoolkit import pprinter as pp
|
from gentoolkit import pprinter as pp
|
||||||
|
|
||||||
|
from euscan.helpers import dict_to_xml
|
||||||
|
|
||||||
mirrors_ = None
|
mirrors_ = None
|
||||||
|
|
||||||
|
|
||||||
@ -200,6 +202,8 @@ class EuscanOutput(object):
|
|||||||
format_ = format_ or self.config["format"]
|
format_ = format_ or self.config["format"]
|
||||||
if format_.lower() == "json":
|
if format_.lower() == "json":
|
||||||
return json.dumps(data, indent=self.config["indent"])
|
return json.dumps(data, indent=self.config["indent"])
|
||||||
|
elif format_.lower() == "xml":
|
||||||
|
return dict_to_xml(data, indent=self.config["indent"])
|
||||||
elif format_.lower() == "dict":
|
elif format_.lower() == "dict":
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user