forked from platformio/platformio-core
Finally removed all tracks to the Python 2.7
This commit is contained in:
1 parent
541fcbf015
commit
5e18f9bbda
17 files changed
+49
-117
No files matched your search
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import click
|
||||
|
||||
@@ -22,11 +23,6 @@ from platformio.package.exception import UnknownPackageError
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.package.version import cast_version_to_semver
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class RegistryFileMirrorIterator(object):
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import json
|
||||
import os
|
||||
import re
|
||||
import tarfile
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from platformio import util
|
||||
from platformio.clients.http import fetch_remote_content
|
||||
@@ -25,11 +26,6 @@ from platformio.compat import get_object_members, string_types
|
||||
from platformio.package.exception import ManifestParserError, UnknownManifestError
|
||||
from platformio.project.helpers import is_platformio_project
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class ManifestFileType(object):
|
||||
PLATFORM_JSON = "platform.json"
|
||||
|
||||
@@ -26,37 +26,21 @@ from platformio.clients.http import fetch_remote_content
|
||||
from platformio.package.exception import ManifestValidationError
|
||||
from platformio.util import memoized
|
||||
|
||||
MARSHMALLOW_2 = marshmallow.__version_info__ < (3,)
|
||||
|
||||
class BaseSchema(Schema):
|
||||
class Meta(object): # pylint: disable=no-init
|
||||
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
||||
|
||||
if MARSHMALLOW_2:
|
||||
|
||||
class CompatSchema(Schema):
|
||||
pass
|
||||
|
||||
else:
|
||||
|
||||
class CompatSchema(Schema):
|
||||
class Meta(object): # pylint: disable=no-init
|
||||
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
||||
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
raise ManifestValidationError(
|
||||
error.messages,
|
||||
data,
|
||||
error.valid_data if hasattr(error, "valid_data") else error.data,
|
||||
)
|
||||
|
||||
|
||||
class BaseSchema(CompatSchema):
|
||||
def load_manifest(self, data):
|
||||
if MARSHMALLOW_2:
|
||||
data, errors = self.load(data)
|
||||
if errors:
|
||||
raise ManifestValidationError(errors, data, data)
|
||||
return data
|
||||
return self.load(data)
|
||||
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
raise ManifestValidationError(
|
||||
error.messages,
|
||||
data,
|
||||
error.valid_data if hasattr(error, "valid_data") else error.data,
|
||||
)
|
||||
|
||||
|
||||
class StrictSchema(BaseSchema):
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
@@ -67,8 +51,6 @@ class StrictSchema(BaseSchema):
|
||||
]
|
||||
else:
|
||||
error.valid_data = None
|
||||
if MARSHMALLOW_2:
|
||||
error.data = error.valid_data
|
||||
raise error
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from platformio import proc
|
||||
from platformio.package.exception import (
|
||||
@@ -24,11 +25,6 @@ from platformio.package.exception import (
|
||||
UserSideException,
|
||||
)
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class VCSBaseException(PackageException):
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user