mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Package version as "Repository URL" in manifest of development version
This commit is contained in:
@ -24,6 +24,8 @@ PlatformIO 3.0
|
|||||||
command (allows to avoid automatic board's auto-reset when gathering test results)
|
command (allows to avoid automatic board's auto-reset when gathering test results)
|
||||||
* Added support for templated methods in ``*.ino to *.cpp`` converter
|
* Added support for templated methods in ``*.ino to *.cpp`` converter
|
||||||
(`pull #858 <https://github.com/platformio/platformio-core/pull/858>`_)
|
(`pull #858 <https://github.com/platformio/platformio-core/pull/858>`_)
|
||||||
|
* Package version as "Repository URL" in manifest of development version
|
||||||
|
(``"version": "https://github.com/user/repo.git"``)
|
||||||
* Produce less noisy output when ``-s/--silent`` options are used for
|
* Produce less noisy output when ``-s/--silent`` options are used for
|
||||||
`platformio init <http://docs.platformio.org/page/userguide/cmd_init.html>`__
|
`platformio init <http://docs.platformio.org/page/userguide/cmd_init.html>`__
|
||||||
and `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__
|
and `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__
|
||||||
|
2
docs
2
docs
Submodule docs updated: 6a31b437c5...91e3a088ef
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (3, 3, "0a6")
|
VERSION = (3, 3, "0a7")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@ -233,39 +234,55 @@ class PkgInstallerMixin(object):
|
|||||||
return pkg_dir
|
return pkg_dir
|
||||||
|
|
||||||
def _install_from_tmp_dir(self, tmp_dir, requirements=None):
|
def _install_from_tmp_dir(self, tmp_dir, requirements=None):
|
||||||
tmpmanifest = self.load_manifest(tmp_dir)
|
tmp_manifest_path = self.get_manifest_path(tmp_dir)
|
||||||
assert set(["name", "version"]) <= set(tmpmanifest.keys())
|
tmp_manifest = self.load_manifest(tmp_manifest_path)
|
||||||
name = tmpmanifest['name']
|
assert set(["name", "version"]) <= set(tmp_manifest.keys())
|
||||||
|
|
||||||
|
name = tmp_manifest['name']
|
||||||
pkg_dir = join(self.package_dir, name)
|
pkg_dir = join(self.package_dir, name)
|
||||||
if "id" in tmpmanifest:
|
if "id" in tmp_manifest:
|
||||||
name += "_ID%d" % tmpmanifest['id']
|
name += "_ID%d" % tmp_manifest['id']
|
||||||
pkg_dir = join(self.package_dir, name)
|
pkg_dir = join(self.package_dir, name)
|
||||||
|
|
||||||
# package should satisfy requirements
|
# package should satisfy requirements
|
||||||
if requirements:
|
if requirements:
|
||||||
mismatch_error = (
|
mismatch_error = (
|
||||||
"Package version %s doesn't satisfy requirements %s" % (
|
"Package version %s doesn't satisfy requirements %s" % (
|
||||||
tmpmanifest['version'], requirements))
|
tmp_manifest['version'], requirements))
|
||||||
try:
|
try:
|
||||||
reqspec = semantic_version.Spec(requirements)
|
reqspec = semantic_version.Spec(requirements)
|
||||||
tmpmanver = semantic_version.Version(
|
tmp_version = semantic_version.Version(
|
||||||
tmpmanifest['version'], partial=True)
|
tmp_manifest['version'], partial=True)
|
||||||
assert tmpmanver in reqspec, mismatch_error
|
assert tmp_version in reqspec, mismatch_error
|
||||||
|
except ValueError:
|
||||||
|
assert tmp_manifest['version'] == requirements, mismatch_error
|
||||||
|
|
||||||
|
if self.manifest_exists(pkg_dir):
|
||||||
|
cur_manifest_path = self.get_manifest_path(pkg_dir)
|
||||||
|
cur_manifest = self.load_manifest(cur_manifest_path)
|
||||||
|
|
||||||
|
if tmp_manifest_path.endswith(self.VCS_MANIFEST_NAME):
|
||||||
|
if cur_manifest.get("url") != tmp_manifest['url']:
|
||||||
|
pkg_dir = join(self.package_dir, "%s@vcs-%s" % (
|
||||||
|
name, hashlib.md5(tmp_manifest['url']).hexdigest()))
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
tmp_version = semantic_version.Version(
|
||||||
|
tmp_manifest['version'], partial=True)
|
||||||
|
cur_version = semantic_version.Version(
|
||||||
|
cur_manifest['version'], partial=True)
|
||||||
|
|
||||||
if self.manifest_exists(pkg_dir):
|
|
||||||
curmanifest = self.load_manifest(pkg_dir)
|
|
||||||
curmanver = semantic_version.Version(
|
|
||||||
curmanifest['version'], partial=True)
|
|
||||||
# if current package version < new package, backup it
|
# if current package version < new package, backup it
|
||||||
if tmpmanver > curmanver:
|
if tmp_version > cur_version:
|
||||||
os.rename(pkg_dir,
|
os.rename(pkg_dir,
|
||||||
join(self.package_dir, "%s@%s" %
|
join(self.package_dir, "%s@%s" %
|
||||||
(name, curmanifest['version'])))
|
(name, cur_manifest['version'])))
|
||||||
elif tmpmanver < curmanver:
|
elif tmp_version < cur_version:
|
||||||
pkg_dir = join(self.package_dir, "%s@%s" %
|
pkg_dir = join(self.package_dir, "%s@%s" %
|
||||||
(name, tmpmanifest['version']))
|
(name, tmp_manifest['version']))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
assert tmpmanifest['version'] == requirements, mismatch_error
|
pkg_dir = join(self.package_dir,
|
||||||
|
"%s@%s" % (name, tmp_manifest['version']))
|
||||||
|
|
||||||
# remove previous/not-satisfied package
|
# remove previous/not-satisfied package
|
||||||
if isdir(pkg_dir):
|
if isdir(pkg_dir):
|
||||||
@ -419,7 +436,12 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
elif not pkg_id and manifest['name'] != name:
|
elif not pkg_id and manifest['name'] != name:
|
||||||
continue
|
continue
|
||||||
elif not reqspec and requirements:
|
elif not reqspec and requirements:
|
||||||
if requirements == manifest['version']:
|
conds = [
|
||||||
|
requirements == manifest['version'],
|
||||||
|
"://" in requirements and
|
||||||
|
requirements in manifest.get("url", "")
|
||||||
|
]
|
||||||
|
if any(conds):
|
||||||
best = manifest
|
best = manifest
|
||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
@ -435,11 +457,13 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
|||||||
best = manifest
|
best = manifest
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if best:
|
if best:
|
||||||
# check that URL is the same in installed package (VCS)
|
# check that URL is the same in installed package (VCS)
|
||||||
if url and best.get("url") != url:
|
if url and best.get("url") != url:
|
||||||
return None
|
return None
|
||||||
return best
|
return best
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_package_dir(self, name, requirements=None, url=None):
|
def get_package_dir(self, name, requirements=None, url=None):
|
||||||
|
Reference in New Issue
Block a user