Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
6eacfa1
Initial commit
lasote Dec 1, 2015
c7862b5
Python 3 support and CI
lasote Mar 18, 2016
1d8e4b1
Versin compare fix
lasote Mar 21, 2016
ab3e41e
Reverted version check
lasote Mar 21, 2016
faca806
Fixed output testing issues and improved version detection
lasote Mar 21, 2016
190a028
Merge branch 'release/0.9.0'
lasote May 3, 2016
fa1f2a7
capturing traceback for offending line report
memsharded Aug 27, 2016
961939a
Merge branch 'release/0.11.1'
lasote Aug 31, 2016
9d22c14
Merge tag '0.11.1' into develop
lasote Aug 31, 2016
0056863
Merge branch 'release/0.12.0'
lasote Sep 13, 2016
65448f9
Merge tag '0.12.0' into develop
lasote Sep 13, 2016
b2ec8ae
fixing migrations with no settings.yml. Fixing Version parsing and co…
memsharded Sep 14, 2016
d529ee1
Better version compare in order to allow a 0.12.1-dev0 client operate…
lasote Sep 20, 2016
9d4d9fd
Merge branch 'release/0.13.0'
lasote Oct 3, 2016
705af5c
Merge tag '0.13.0' into develop
lasote Oct 3, 2016
3467748
Feature/better upload (#795)
lasote Dec 27, 2016
43f96b3
Moved retry to uploader_downloader, removed UploadException, changed …
lasote Jan 3, 2017
5296756
Release/0.18 better retries and exception handling (#828)
lasote Jan 3, 2017
175d4a3
Merge branch 'release/0.18' of github.com:conan-io/conan into release…
lasote Jan 3, 2017
00c14a3
Merge tag '0.18.0' into develop
lasote Jan 3, 2017
d58ef71
Feature/improve semver (#927)
memsharded Jan 31, 2017
c46f3b4
Merge branch 'release/0.19.0'
lasote Jan 31, 2017
f5e5471
Merge tag '0.19.0' into develop
lasote Jan 31, 2017
c5e05b2
added new version modes, fixed string versions (#1108)
memsharded Mar 16, 2017
2395801
Merge branch 'release/0.21.0'
lasote Mar 21, 2017
eeb9764
Merge tag '0.21.0' into develop
lasote Mar 21, 2017
fb69ace
Merge branch 'release/0.22.0'
lasote Apr 18, 2017
6e4ba95
Merge tag '0.22.0' into develop
lasote Apr 18, 2017
628c471
Feature/exception messages (#1301)
lasote May 19, 2017
d0c3fdb
Merge branch 'release/0.23.0'
lasote Jun 1, 2017
ec59d46
minor style fixes (#1698)
memsharded Sep 4, 2017
52d16cc
Feature/full traceback (#1703)
lasote Sep 11, 2017
8e54ad0
Better catches
lasote Jan 29, 2018
ce6b5b2
improved messages, fix manifest exceptions (#2665)
memsharded Mar 27, 2018
aa3ea86
Feature/refactor get package (#2722)
memsharded Apr 16, 2018
e3aea90
Feature/improve output (#2728)
lasote Apr 23, 2018
429da79
Fix version class for greater than comparison (#2927)
danimtb May 25, 2018
636886c
Fixed build property in Version class (#3219)
danimtb Jul 16, 2018
22e143d
Add ConanInvalidConfiguration exception and handle error codes. (#3517)
jgsogo Sep 24, 2018
524251d
v2 refactor (#4512)
lasote Feb 15, 2019
d8f5b23
[CLI] Accept a PackageReference in the command 'get' (preferred) (#4494)
jgsogo Feb 18, 2019
1dd75f1
fix develop (#4560)
memsharded Feb 18, 2019
ef577a4
Fail nicely without revisions and only_v2 (#4663)
lasote Mar 6, 2019
b3c9ad7
Merge branch 'release/1.13.0'
lasote Mar 7, 2019
2bb8ca8
Merge tag '1.13.0' into develop
lasote Mar 7, 2019
560eae1
Merge branch 'release/1.14.0'
lasote Mar 28, 2019
b05f806
Merge tag '1.14.0' into develop
lasote Mar 28, 2019
20f770a
print a message for unknown errors building the API (#4869)
jgsogo Mar 31, 2019
86bd2c5
Merge branch 'release/1.14.1'
lasote Apr 1, 2019
6ad9bea
Merge tag '1.14.1' into develop
lasote Apr 1, 2019
0fbc897
Some docstrings for version class (#4274)
danimtb Apr 2, 2019
044bbe9
Merge branch 'release/1.15.0'
lasote May 6, 2019
1a18827
Merge tag '1.15.0' into develop
lasote May 6, 2019
5353291
Merge branch 'release/1.16.0'
lasote Jun 4, 2019
8dc9d51
Better ref representation (#5509)
lasote Jul 19, 2019
9d9f5cd
Optional user/channel (#5381)
lasote Jul 24, 2019
df25942
Fix print stderr on failure at `check_output` tool. (#5548)
lasote Jul 29, 2019
3a7c417
Merge branch 'release/1.18.0'
lasote Jul 30, 2019
03cac1d
Merge tag '1.18.0' into develop
lasote Jul 30, 2019
8c9fcd2
Merge branch 'release/1.19.0'
lasote Sep 30, 2019
e52842f
Merge tag '1.19.0' into develop
lasote Sep 30, 2019
9d5161d
Requirement override using build metadata (#5903)
lasote Oct 15, 2019
cd197be
Merge branch 'release/1.19.2'
lasote Oct 16, 2019
ab0fd41
Merged 1.19.2
lasote Oct 16, 2019
b2cdeac
Merge pull request #1 from conan-io/develop
nicememory Oct 21, 2019
2c5eae4
Merge branch 'release/1.20.0'
lasote Nov 4, 2019
559f576
Merge tag '1.20.0' into develop
lasote Nov 4, 2019
3629cdf
Merge pull request #6037 from nicememory/improving_error_message
memsharded Nov 7, 2019
8c675e5
Merge branch 'release/1.21.0'
lasote Dec 10, 2019
5f7d7b2
Add 'CONAN_V2_MODE' to start testing Conan v2 deprecated features (#6…
memsharded Mar 4, 2020
dab7e05
Merge branch 'release/1.23.0'
czoido Mar 10, 2020
7ec660e
Remove disabled_revisions mode from 2.0: Remove support api v1 (#8412)
czoido Feb 2, 2021
01a0e0e
Remove disabled_revisions mode from 2.0: Clean enabled_revisions (#8428)
czoido Feb 5, 2021
1720db1
Introducing ConanErrorConfiguration exception (#9268)
memsharded Jul 21, 2021
90a5097
Implement --update flows for revisions in conan cache 2.0 (#9191)
czoido Aug 30, 2021
8730046
Remove CppInfo and update to NewCppInfo (#9657)
czoido Oct 15, 2021
77c20f7
Add return code 7 (Invalid system requirements) (#9905)
n-bes Nov 2, 2021
b4aa374
merged develop
memsharded Nov 2, 2021
553c652
removing python 2 legacy (#9927)
memsharded Nov 3, 2021
f5555f8
Removed PackageReference in favor of PkgReference (#9933)
lasote Nov 3, 2021
4a81db5
some new Version improvements for build and pre-releases (#9930)
memsharded Nov 3, 2021
c769b3a
RecipeReference + Interfaces renaming and improving (#9982)
lasote Nov 8, 2021
1edbc9c
Remove legacy activation of environment (#10007)
memsharded Nov 15, 2021
83d76db
introducing new version_range model (#9970)
memsharded Nov 16, 2021
f5fd9e6
fixing version equality (#10036)
memsharded Nov 18, 2021
3c9c947
Fixing some comparisons in new Version model (#10051)
memsharded Nov 19, 2021
523433f
remove legacy Version classes, use new one (#10052)
memsharded Nov 22, 2021
6a778d3
[develop2] remove dep to node-semver (#10058)
memsharded Nov 25, 2021
eef8bf3
minor cleanings and refactors (#10135)
memsharded Dec 7, 2021
5a44eec
fix version ranges pre-releases (#10149)
memsharded Dec 9, 2021
6edc7d8
checking tilde with prerelease excluded too (#10151)
memsharded Dec 9, 2021
e251243
moving _compilers to tools.build.flags and other minor cleanings (#10…
memsharded Dec 20, 2021
4c7f417
[develop2] minor refactors and cleaning BinaryInstaller (#10577)
memsharded Feb 17, 2022
5719b0f
remove conanfile attrs improvements (#10844)
memsharded Mar 21, 2022
d49a589
fix tools.scm.Version construction from non-str (#11119)
memsharded Apr 28, 2022
e6b2509
merged develop
memsharded May 2, 2022
b61525b
removed CalledProcessError exception (#11195)
memsharded May 9, 2022
28d17d3
[develop2] Try to revert ``check_min_cppstd`` to use ``self.settings`…
memsharded Nov 18, 2022
b02d902
Add better error UX when spaces are found in required_conan_version (…
AbrilRBS Dec 12, 2022
4b7c5d3
[develop2] display tracebacks in test errors (#12928)
memsharded Jan 19, 2023
6b6add3
[bugfix] `Version` int comparison (#12934)
franramirez688 Jan 20, 2023
a471260
merged develop
memsharded Jan 20, 2023
50ed1a7
[develop2] Improve error messages for wrong methods (#12962)
memsharded Jan 24, 2023
5e5846d
[develop2] Fix MesonToolchain wrong cppstd in apple-clang (#13172)
memsharded Feb 20, 2023
e5c842f
Add ConanVersionRange class and test #101
johnmhoran Feb 23, 2023
570f4ad
Fix import formatting #101
johnmhoran Feb 23, 2023
d71d003
Change scheme from conan to conan1 #101
johnmhoran Feb 23, 2023
0c3283b
Add test and fix failing tests #101
johnmhoran Feb 23, 2023
231039b
Fix 'gitlab_scheme'-related test failures #101
johnmhoran Feb 24, 2023
f6dda4c
verbose tracebacks (#13226)
memsharded Feb 27, 2023
c3d57ce
Change references from 'conan1' to 'conan' #101
johnmhoran Mar 1, 2023
ad674bf
Restructure conan version and tests
TG1999 Mar 1, 2023
d0edd52
Reuse conan code from https://github.com/conan-io/conan
TG1999 Mar 1, 2023
308d645
Modify imports according to restructured code
TG1999 Mar 1, 2023
ce76f0e
Fix formatting errors
TG1999 Mar 1, 2023
2290ed2
Adjust conan code according to univers #101
johnmhoran Mar 1, 2023
48dc602
Use conan 2.0 as default conan version
TG1999 Mar 2, 2023
1e56074
Add .ABOUT, .NOTICE files #101
johnmhoran Mar 8, 2023
01ff53e
Add .ABOUT, .NOTICE files for Conan test files #101
johnmhoran Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added src/univers/conan/__init__.py
Empty file.
252 changes: 252 additions & 0 deletions src/univers/conan/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
#
# Copyright (c) 2019 JFrog LTD
# SPDX-License-Identifier: MIT
#
# Visit https://aboutcode.org and https://github.com/nexB/univers for support and download.

"""
Comment thread
johnmhoran marked this conversation as resolved.
Exceptions raised and handled in Conan
These exceptions are mapped between server (as an HTTP response) and client
through the REST API. When an error happens in server its translated to an HTTP
error code that its sent to client. Client reads the server code and raise the
matching exception.

see return_plugin.py

"""
from contextlib import contextmanager


@contextmanager
def conanfile_remove_attr(conanfile, names, method):
"""remove some self.xxxx attribute from the class, so it raises an exception if used
within a given conanfile method
"""
original_class = type(conanfile)

def _prop(attr_name):
def _m(_):
raise ConanException(f"'self.{attr_name}' access in '{method}()' method is forbidden")

return property(_m)

try:
new_class = type(original_class.__name__, (original_class,), {})
conanfile.__class__ = new_class
for name in names:
setattr(new_class, name, _prop(name))
yield
finally:
conanfile.__class__ = original_class


@contextmanager
def conanfile_exception_formatter(conanfile_name, func_name):
"""
Decorator to throw an exception formatted with the line of the conanfile where the error ocurrs.
"""

def _raise_conanfile_exc(e):
m = _format_conanfile_exception(conanfile_name, func_name, e)
raise ConanExceptionInUserConanfileMethod(m)

try:
yield
# TODO: Move ConanInvalidConfiguration from here?
except ConanInvalidConfiguration as exc:
msg = "{}: Invalid configuration: {}".format(str(conanfile_name), exc)
raise ConanInvalidConfiguration(msg)
except AttributeError as exc:
list_methods = [m for m in dir(list) if not m.startswith("__")]
if (
"NoneType" in str(exc)
and func_name in ["layout", "package_info"]
and any(method in str(exc) for method in list_methods)
):
raise ConanException(
"{}: {}. No default values are set for components. You are probably "
"trying to manipulate a component attribute in the '{}' method "
"without defining it previously".format(str(conanfile_name), exc, func_name)
)
else:
_raise_conanfile_exc(exc)
except Exception as exc:
_raise_conanfile_exc(exc)


def _format_conanfile_exception(scope, method, exception):
"""
It will iterate the traceback lines, when it finds that the source code is inside the users
conanfile it "start recording" the messages, when the trace exits the conanfile we return
the traces.
"""
import sys
import traceback

try:
conanfile_reached = False
tb = sys.exc_info()[2]
index = 0
content_lines = []

while True: # If out of index will raise and will be captured later
# 40 levels of nested functions max, get the latest
filepath, line, name, contents = traceback.extract_tb(tb, 40)[index]
if "conanfile.py" not in filepath: # Avoid show trace from internal conan source code
if conanfile_reached: # The error goes to internal code, exit print
break
else:
if not conanfile_reached: # First line
msg = "%s: Error in %s() method" % (scope, method)
msg += ", line %d\n\t%s" % (line, contents)
else:
msg = (
"while calling '%s', line %d\n\t%s" % (name, line, contents)
if line
else "\n\t%s" % contents
)
content_lines.append(msg)
conanfile_reached = True
index += 1
except Exception:
pass
ret = "\n".join(content_lines)
ret += "\n\t%s: %s" % (exception.__class__.__name__, str(exception))
return ret


class ConanException(Exception):
"""
Generic conans exception
"""

def __init__(self, *args, **kwargs):
self.info = None
self.remote = kwargs.pop("remote", None)
super(ConanException, self).__init__(*args, **kwargs)

def remote_message(self):
if self.remote:
return " [Remote: {}]".format(self.remote.name)
return ""

def __str__(self):

msg = super(ConanException, self).__str__()

try:
msg = str(msg)
except Exception:
msg = repr(msg)

if self.remote:
return "{}.{}".format(msg, self.remote_message())

return msg


class ConanReferenceDoesNotExistInDB(ConanException):
"""Reference does not exist in cache db"""

pass


class ConanReferenceAlreadyExistsInDB(ConanException):
"""Reference already exists in cache db"""

pass


class NoRemoteAvailable(ConanException):
"""No default remote configured or the specified remote do not exists"""

pass


class InvalidNameException(ConanException):
pass


class ConanConnectionError(ConanException):
pass


class ConanOutdatedClient(ConanException):
pass


class ConanExceptionInUserConanfileMethod(ConanException):
pass


class ConanInvalidConfiguration(ConanExceptionInUserConanfileMethod):
"""
This binary, for the requested configuration and package-id cannot be built
"""

pass


class ConanMigrationError(ConanException):
pass


# Remote exceptions #
class InternalErrorException(ConanException):
"""
Generic 500 error
"""

pass


class RequestErrorException(ConanException):
"""
Generic 400 error
"""

pass


class AuthenticationException(ConanException): # 401
"""
401 error
"""

pass


class ForbiddenException(ConanException): # 403
"""
403 error
"""

pass


class NotFoundException(ConanException): # 404
"""
404 error
"""

def __init__(self, *args, **kwargs):
self.remote = kwargs.pop("remote", None)
super(NotFoundException, self).__init__(*args, **kwargs)


class UserInterfaceErrorException(RequestErrorException):
"""
420 error
"""

pass


EXCEPTION_CODE_MAPPING = {
InternalErrorException: 500,
RequestErrorException: 400,
AuthenticationException: 401,
ForbiddenException: 403,
NotFoundException: 404,
UserInterfaceErrorException: 420,
}
8 changes: 8 additions & 0 deletions src/univers/conan/errors.py.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
about_resource: errors.py
package_url: pkg:pypi/conan@2.0.0
copyright: |
Copyright (c) 2019 JFrog LTD
download_url: https://github.com/conan-io/conan/blob/release/2.0/conans/errors.py
license_expression: MIT
homepage_url: https://github.com/conan-io/conan
notice_file: errors.py.NOTICE
21 changes: 21 additions & 0 deletions src/univers/conan/errors.py.NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 JFrog LTD

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading