-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[develop2] remove api_method decorator (#13091)
* [develop2] remove api_method decorator * remove dead test
- Loading branch information
1 parent
d43b1c3
commit df521af
Showing
15 changed files
with
2 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +0,0 @@ | ||
import functools | ||
import os | ||
|
||
from conans.util.tracer import log_conan_api_call | ||
|
||
|
||
def api_method(f): | ||
"""Useful decorator to manage Conan API methods""" | ||
|
||
@functools.wraps(f) | ||
def wrapper(subapi, *args, **kwargs): | ||
try: # getcwd can fail if Conan runs on an non-existing folder | ||
old_curdir = os.getcwd() | ||
except EnvironmentError: | ||
old_curdir = None | ||
|
||
try: | ||
# FIXME: Fix this hack if we want to keep the action recorder | ||
subapi_name = str(subapi.__class__.__name__).replace("API", "").lower() | ||
log_conan_api_call("{}.{}".format(subapi_name, f.__name__), kwargs) | ||
return f(subapi, *args, **kwargs) | ||
finally: | ||
if old_curdir: | ||
os.chdir(old_curdir) | ||
|
||
return wrapper | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.