def __init__(self, cache_dir=None): self.cache_dir = None self._db_path = None self._lockfile = None self.cache_dir = cache_dir or util.get_cache_dir() self._db_path = join(self.cache_dir, "db.data")
def get_pip_package(to_develop): if not to_develop: return "platformio" dl_url = ("https://github.com/platformio/" "platformio-core/archive/develop.zip") cache_dir = util.get_cache_dir() if not os.path.isdir(cache_dir): os.makedirs(cache_dir) pkg_name = os.path.join(cache_dir, "piocoredevelop.zip") try: with open(pkg_name, "w") as fp: r = util.exec_command( ["curl", "-fsSL", dl_url], stdout=fp, universal_newlines=True) assert r['returncode'] == 0 # check ZIP structure with ZipFile(pkg_name) as zp: assert zp.testzip() is None return pkg_name except: # pylint: disable=bare-except pass return dl_url
def get_pip_package(to_develop): if not to_develop: return "platformio" dl_url = ("https://github.com/platformio/" "platformio-core/archive/develop.zip") cache_dir = util.get_cache_dir() if not os.path.isdir(cache_dir): os.makedirs(cache_dir) pkg_name = os.path.join(cache_dir, "piocoredevelop.zip") try: with open(pkg_name, "w") as fp: r = util.exec_command(["curl", "-fsSL", dl_url], stdout=fp, universal_newlines=True) assert r['returncode'] == 0 # check ZIP structure with ZipFile(pkg_name) as zp: assert zp.testzip() is None return pkg_name except: # pylint: disable=bare-except pass return dl_url