...
 
Commits (2)
......@@ -7,7 +7,7 @@ build:2.7:
image: "python:2.7"
stage: "build"
script:
- "./tools/local_install.sh -2 ~/bin"
- "./tools/local_install.sh -2 --local-modules ~/bin"
pyflakes:2.7:
image: "python:2.7"
......@@ -45,7 +45,7 @@ build:3:
image: "python:3"
stage: "build"
script:
- "./tools/local_install.sh ~/bin"
- "./tools/local_install.sh --local-modules ~/bin"
pyflakes:3:
image: "python:3"
......
......@@ -18,13 +18,14 @@
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from datetime import date
from itertools import imap, ifilter
from weboob.browser.pages import JsonPage, HTMLPage
from six.moves import filter, map
from weboob.browser.elements import ItemElement, ListElement, method
from weboob.capabilities.weather import Forecast, Current, City, Temperature
from weboob.browser.filters.json import Dict
from weboob.browser.filters.standard import Filter, CleanText
from weboob.browser.filters.standard import CleanText, Filter
from weboob.browser.pages import HTMLPage, JsonPage
from weboob.capabilities.weather import City, Current, Forecast, Temperature
class Id(Filter):
......@@ -100,9 +101,9 @@ class WeatherPage(HTMLPage):
def info_for_value(value):
return CleanText(value % offset)(self).replace(u'edeltävän tunnin ', u'')
return ("klo %s: " % hour) + ", ".join(ifilter(bool, imap(info_for_value, values)))
return ("klo %s: " % hour) + ", ".join(filter(bool, map(info_for_value, values)))
return u'\n' + u'\n'.join(ifilter(bool, imap(descriptive_text_for_hour, ["02", "03", "14", "15"])))
return u'\n' + u'\n'.join(filter(bool, map(descriptive_text_for_hour, ["02", "03", "14", "15"])))
def get_station_id(self):
return CleanText(u'//select[@id="observation-station-menu"]/option[@selected="selected"]/@value')(self.doc)
......
......@@ -6,8 +6,15 @@ import os
import subprocess
import sys
if '--local-modules' in sys.argv:
local_modules = True
sys.argv.remove('--local-modules')
else:
local_modules = False
print("Weboob local installer")
print()
if len(sys.argv) < 2:
print("This tool will install Weboob to be usuable without requiring")
print("messing with your system, which should only be touched by a package manager.")
......@@ -22,12 +29,25 @@ else:
print("Installing weboob applications into ‘%s’." % dest)
if local_modules:
sourceslist = os.path.join(
os.environ.get('XDG_CONFIG_HOME', os.path.join(os.path.expanduser('~'), '.config')),
'weboob', 'sources.list')
if not os.path.isdir(os.path.dirname(sourceslist)):
os.makedirs(os.path.dirname(sourceslist))
if not os.path.exists(sourceslist):
with open(sourceslist, 'w') as f:
f.write('file://' + os.path.realpath(
os.path.join(os.path.dirname(__file__), os.pardir, 'modules')
))
subprocess.check_call(
[sys.executable, 'setup.py',
'install', '--user', '--install-scripts=%s' % dest] + sys.argv[2:],
cwd=os.path.join(os.path.dirname(__file__), os.pardir))
subprocess.check_call([sys.executable, os.path.join(dest, 'weboob-config'), 'update'])
subprocess.call([sys.executable, os.path.join(dest, 'weboob-config'), 'update'])
print()
print("Installation done. Applications are available in ‘%s’." % dest)
......