Commit 9359dede authored by Marco Mariani's avatar Marco Mariani

grid: detect platform for binary cache support under cygwin

parent 4e428fdc
......@@ -10,7 +10,7 @@ import sys
import prettytable
from slapos.grid import networkcache
from slapos.grid.distribution import patched_linux_distribution
from slapos.grid.distribution import distribution_tuple
from slapos.cli.config import ConfigCommand
......@@ -76,7 +76,7 @@ def do_lookup(logger, cache_dir, software_url):
pt = prettytable.PrettyTable(['distribution', 'version', 'id', 'compatible?'])
linux_distribution = patched_linux_distribution()
linux_distribution = distribution_tuple()
for os in ostable:
compatible = 'yes' if networkcache.os_matches(os, linux_distribution) else 'no'
......
......@@ -13,6 +13,9 @@ patched_linux_distribution(...):
see http://bugs.python.org/issue9514
otherwise, Ubuntu will always be reported as an unstable Debian, regardless of the version.
distribution_tuple()
returns a (distname, version, id) tuple under linux or cygwin
"""
import platform
......@@ -62,3 +65,10 @@ def patched_linux_distribution(distname='', version='', id='',
pass
return platform.linux_distribution(distname, version, id, supported_dists, full_distribution_name)
def distribution_tuple():
if platform.system().startswith('CYGWIN_'):
return (platform.system(), platform.platform(), '')
else:
return patched_linux_distribution()
......@@ -18,7 +18,7 @@ import platform
import shutil
import traceback
from slapos.grid.distribution import os_matches, patched_linux_distribution
from slapos.grid.distribution import os_matches, distribution_tuple
try:
try:
......@@ -88,7 +88,7 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
if tags.get('machine') != platform.machine():
continue
if not os_matches(ast.literal_eval(tags.get('os')),
patched_linux_distribution()):
distribution_tuple()):
continue
if tags.get('software_url') != software_url:
continue
......@@ -134,7 +134,7 @@ def upload_network_cached(software_root, software_url, cached_key,
software_url=software_url,
software_root=software_root,
machine=platform.machine(),
os=str(patched_linux_distribution())
os=str(distribution_tuple())
)
f = open(path, 'r')
......
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