├── __init__.py ├── .ci ├── __init__.py ├── jenkins │ └── Jenkinsfile └── bump_dev_version.py ├── conans ├── util │ ├── __init__.py │ ├── templates.py │ ├── sha.py │ ├── dates.py │ ├── fallbacks.py │ ├── env_reader.py │ ├── conan_v2_mode.py │ └── log.py ├── assets │ ├── __init__.py │ └── templates │ │ ├── info_dot.py │ │ └── __init__.py ├── client │ ├── __init__.py │ ├── cache │ │ └── __init__.py │ ├── cmd │ │ ├── __init__.py │ │ └── user.py │ ├── graph │ │ └── __init__.py │ ├── store │ │ └── __init__.py │ ├── conanfile │ │ ├── __init__.py │ │ ├── build.py │ │ └── configure.py │ ├── recorder │ │ └── __init__.py │ ├── build │ │ └── __init__.py │ ├── tools │ │ ├── android.py │ │ ├── __init__.py │ │ └── version.py │ ├── generators │ │ ├── gcc.py │ │ ├── virtualrunenv.py │ │ ├── virtualenv_python.py │ │ ├── virtualbuildenv.py │ │ ├── visualstudiolegacy.py │ │ ├── cmake_paths.py │ │ └── boostbuild.py │ ├── rest │ │ └── __init__.py │ └── run_environment.py ├── search │ └── __init__.py ├── server │ ├── __init__.py │ ├── crypto │ │ ├── __init__.py │ │ └── jwt │ │ │ ├── __init__.py │ │ │ ├── jwt_credentials_manager.py │ │ │ ├── jwt_manager.py │ │ │ └── jwt_updown_manager.py │ ├── rest │ │ ├── __init__.py │ │ ├── controller │ │ │ ├── __init__.py │ │ │ ├── common │ │ │ │ ├── __init__.py │ │ │ │ ├── ping.py │ │ │ │ └── users.py │ │ │ ├── v1 │ │ │ │ ├── __init__.py │ │ │ │ └── search.py │ │ │ └── v2 │ │ │ │ ├── __init__.py │ │ │ │ └── search.py │ │ ├── bottle_plugins │ │ │ ├── __init__.py │ │ │ ├── http_basic_authentication.py │ │ │ └── jwt_authentication.py │ │ ├── bottle_routes.py │ │ ├── api_v2.py │ │ └── server.py │ ├── service │ │ ├── __init__.py │ │ ├── v1 │ │ │ └── __init__.py │ │ ├── v2 │ │ │ └── __init__.py │ │ ├── common │ │ │ └── __init__.py │ │ ├── mime.py │ │ └── user_service.py │ ├── store │ │ ├── __init__.py │ │ └── url_manager.py │ ├── server_launcher.py │ ├── migrate.py │ └── plugin_loader.py ├── test │ ├── conan_v2 │ │ ├── __init__.py │ │ ├── tools │ │ │ ├── __init__.py │ │ │ └── test_tools_win.py │ │ ├── conanfile │ │ │ ├── __init__.py │ │ │ ├── test_collect_libs.py │ │ │ ├── test_config_method.py │ │ │ ├── test_package_method.py │ │ │ ├── test_environment.py │ │ │ ├── test_source_method.py │ │ │ └── test_package_id_method.py │ │ ├── settings_model │ │ │ └── __init__.py │ │ ├── test_cppinfo.py │ │ ├── test_python_requires.py │ │ ├── test_profile_loader.py │ │ └── test_default_config.py │ ├── unittests │ │ ├── __init__.py │ │ ├── util │ │ │ ├── __init__.py │ │ │ ├── files │ │ │ │ ├── __init__.py │ │ │ │ ├── test_remove.py │ │ │ │ └── test_dirty.py │ │ │ ├── read_only_test.py │ │ │ ├── android_test.py │ │ │ ├── local_db_test.py │ │ │ ├── env_reader_test.py │ │ │ ├── file_hashes_test.py │ │ │ ├── hashed_path_test.py │ │ │ ├── zip_permissions_test.py │ │ │ └── files_test.py │ │ ├── client │ │ │ ├── __init__.py │ │ │ ├── build │ │ │ │ └── __init__.py │ │ │ ├── cmd │ │ │ │ ├── __init__.py │ │ │ │ └── export │ │ │ │ │ └── __init__.py │ │ │ ├── command │ │ │ │ └── __init__.py │ │ │ ├── conf │ │ │ │ ├── __init__.py │ │ │ │ ├── config_installer │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_install_folder.py │ │ │ │ │ └── test_process_folder.py │ │ │ │ └── detect │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── test_gcc_compiler.py │ │ │ ├── graph │ │ │ │ └── __init__.py │ │ │ ├── rest │ │ │ │ ├── __init__.py │ │ │ │ ├── rest_client_v1 │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── test_get_package_manifest.py │ │ │ │ ├── rest_client_v2 │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── test_get_package_manifest.py │ │ │ │ └── response_test.py │ │ │ ├── source │ │ │ │ └── __init__.py │ │ │ ├── tools │ │ │ │ ├── __init__.py │ │ │ │ ├── scm │ │ │ │ │ └── __init__.py │ │ │ │ ├── win │ │ │ │ │ └── __init__.py │ │ │ │ ├── oss │ │ │ │ │ └── __init__.py │ │ │ │ ├── os_info │ │ │ │ │ └── __init__.py │ │ │ │ ├── test_files.py │ │ │ │ ├── collect_libs_test.py │ │ │ │ └── net_test.py │ │ │ ├── util │ │ │ │ ├── __init__.py │ │ │ │ ├── files │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── data │ │ │ │ │ │ ├── .gitattributes │ │ │ │ │ │ ├── conanfile_utf8.txt │ │ │ │ │ │ ├── conanfile_utf8_with_bom.txt │ │ │ │ │ │ ├── conanfile_utf16be_with_bom.txt │ │ │ │ │ │ └── conanfile_utf16le_with_bom.txt │ │ │ │ │ ├── load_test.py │ │ │ │ │ └── decode_text_test.py │ │ │ │ ├── time_test.py │ │ │ │ └── files_test.py │ │ │ ├── file_copier │ │ │ │ ├── __init__.py │ │ │ │ └── test_report_copied_files.py │ │ │ ├── generators │ │ │ │ ├── __init__.py │ │ │ │ ├── virtualenv_python_test.py │ │ │ │ ├── cmake_find_package_multi_test.py │ │ │ │ └── scons_test.py │ │ │ ├── recorder │ │ │ │ └── __init__.py │ │ │ ├── profile_loader │ │ │ │ └── __init__.py │ │ │ ├── userio_test.py │ │ │ ├── remote_manager_test.py │ │ │ ├── conan_output_test.py │ │ │ ├── run_environment_test.py │ │ │ └── optimize_conanfile_load_test.py │ │ ├── model │ │ │ ├── __init__.py │ │ │ ├── scm │ │ │ │ ├── __init__.py │ │ │ │ └── detect_repo_test.py │ │ │ ├── build_info │ │ │ │ ├── __init__.py │ │ │ │ └── cppflags_test.py │ │ │ ├── conan_file │ │ │ │ └── __init__.py │ │ │ ├── editable_layout │ │ │ │ └── __init__.py │ │ │ ├── info │ │ │ │ └── __init__.py │ │ │ ├── values_test.py │ │ │ ├── fake_retriever.py │ │ │ ├── package_metadata_test.py │ │ │ └── conanfile_test.py │ │ ├── search │ │ │ ├── __init__.py │ │ │ └── search_query_parse_test.py │ │ ├── server │ │ │ ├── __init__.py │ │ │ ├── crypto │ │ │ │ ├── __init__.py │ │ │ │ └── jwt_test.py │ │ │ ├── service │ │ │ │ └── __init__.py │ │ │ ├── authenticator_plugin_test.py │ │ │ └── revision_list_test.py │ │ ├── source │ │ │ └── __init__.py │ │ └── tools │ │ │ └── __init__.py │ ├── utils │ │ ├── __init__.py │ │ ├── deprecation.py │ │ ├── profiles.py │ │ └── conan_v2_tests.py │ ├── functional │ │ ├── __init__.py │ │ ├── old │ │ │ ├── __init__.py │ │ │ ├── symlink_package_test.py │ │ │ └── sysroot_test.py │ │ ├── scm │ │ │ ├── __init__.py │ │ │ ├── issues │ │ │ │ └── __init__.py │ │ │ ├── workflows │ │ │ │ └── __init__.py │ │ │ ├── test_url_auto.py │ │ │ └── test_verify_ssl.py │ │ ├── ui │ │ │ ├── __init__.py │ │ │ └── exit_with_code_test.py │ │ ├── cache │ │ │ ├── __init__.py │ │ │ └── rmdir_fail_test.py │ │ ├── command │ │ │ ├── __init__.py │ │ │ ├── download │ │ │ │ ├── __init__.py │ │ │ │ └── download_parallel_test.py │ │ │ ├── install │ │ │ │ ├── __init__.py │ │ │ │ ├── install_parallel_test.py │ │ │ │ ├── install_cwd_test.py │ │ │ │ └── install_missing_dep_test.py │ │ │ ├── upload │ │ │ │ └── __init__.py │ │ │ ├── remove_empty_dirs_test.py │ │ │ └── info_options_test.py │ │ ├── editable │ │ │ ├── __init__.py │ │ │ ├── commands │ │ │ │ ├── __init__.py │ │ │ │ └── inspect_test.py │ │ │ ├── editable_remove_test.py │ │ │ └── transitive_editable_test.py │ │ ├── graph │ │ │ ├── __init__.py │ │ │ ├── version_range_error_test.py │ │ │ └── loop_detection_test.py │ │ ├── hooks │ │ │ ├── __init__.py │ │ │ └── test_post_export.py │ │ ├── options │ │ │ ├── __init__.py │ │ │ └── options_in_requirements_test.py │ │ ├── settings │ │ │ ├── __init__.py │ │ │ ├── cppstd │ │ │ │ └── __init__.py │ │ │ └── per_package_settings_test.py │ │ ├── tools │ │ │ ├── __init__.py │ │ │ └── cpu_count_test.py │ │ ├── build_helpers │ │ │ ├── __init__.py │ │ │ ├── meson_test.py │ │ │ └── cmake_configs_test.py │ │ ├── conan_api │ │ │ ├── __init__.py │ │ │ ├── config_test.py │ │ │ └── curdir_kept_test.py │ │ ├── conanfile │ │ │ ├── __init__.py │ │ │ ├── cpp_info_scope_test.py │ │ │ └── load_requires_file_test.py │ │ ├── configuration │ │ │ ├── __init__.py │ │ │ ├── python_version_test.py │ │ │ ├── invalid_settings_test.py │ │ │ ├── client_certs_test.py │ │ │ └── custom_setting_test_package_test.py │ │ ├── environment │ │ │ └── __init__.py │ │ ├── generators │ │ │ ├── __init__.py │ │ │ ├── assets │ │ │ │ └── cmake_find_package_multi │ │ │ │ │ ├── hello │ │ │ │ │ ├── src │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ ├── hello.h │ │ │ │ │ │ └── hello.cpp │ │ │ │ │ └── conanfile.py │ │ │ │ │ ├── bye │ │ │ │ │ ├── src │ │ │ │ │ │ ├── bye.h │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ └── bye.cpp │ │ │ │ │ └── conanfile.py │ │ │ │ │ └── project_targets │ │ │ │ │ └── CMakeLists.txt │ │ │ └── multi_generators_test.py │ │ ├── graph_lock │ │ │ ├── __init__.py │ │ │ ├── dynamic_test.py │ │ │ └── test_package_test.py │ │ ├── package_id │ │ │ └── __init__.py │ │ ├── py_requires │ │ │ └── __init__.py │ │ ├── workspace │ │ │ └── __init__.py │ │ ├── build_requires │ │ │ └── __init__.py │ │ ├── conan_build_info │ │ │ └── __init__.py │ │ ├── cross_building │ │ │ ├── __init__.py │ │ │ ├── profile_access │ │ │ │ └── __init__.py │ │ │ └── graph │ │ │ │ └── __init__.py │ │ ├── python_requires │ │ │ └── __init__.py │ │ └── remote │ │ │ ├── __init__.py │ │ │ └── requester_test.py │ ├── integration │ │ └── __init__.py │ └── __init__.py ├── paths │ └── package_layouts │ │ └── __init__.py ├── model │ ├── __init__.py │ ├── user_info.py │ └── conan_generator.py ├── requirements_server.txt ├── unicode.py ├── requirements_dev.txt ├── build_info │ ├── __init__.py │ └── model.py ├── conan.py ├── conan_server.py ├── requirements.txt ├── __init__.py └── migrations.py ├── MANIFEST.in ├── setup.cfg ├── tox.ini ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug.md ├── PR_INCREASE_TESTING.md └── PULL_REQUEST_TEMPLATE.md ├── .codeclimate.yml ├── contributors.txt ├── LICENSE.md └── .gitignore /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ci/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/util/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/assets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/search/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE.md -------------------------------------------------------------------------------- /conans/client/cache/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/cmd/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/graph/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/store/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/crypto/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/rest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/service/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/store/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/conan_v2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/assets/templates/info_dot.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/conanfile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/client/recorder/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/crypto/jwt/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/service/v1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/service/v2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/store/url_manager.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/conan_v2/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/old/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/scm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/ui/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/integration/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/util/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/rest/controller/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/service/common/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/conan_v2/conanfile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/cache/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/command/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/editable/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/graph/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/hooks/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/options/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/settings/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/model/scm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/search/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/server/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/source/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/rest/bottle_plugins/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/rest/controller/common/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/server/rest/controller/v1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/conan_v2/settings_model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/build_helpers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/conan_api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/conanfile/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/configuration/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/environment/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/generators/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/graph_lock/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/package_id/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/py_requires/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/scm/issues/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/scm/workflows/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/workspace/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/build/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/cmd/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/command/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conf/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/graph/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/rest/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/source/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/server/crypto/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/server/service/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/util/files/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/build_requires/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/command/download/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/command/install/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/command/upload/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/conan_build_info/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/cross_building/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/editable/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/python_requires/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/settings/cppstd/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/cmd/export/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/file_copier/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/generators/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/recorder/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/tools/scm/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/tools/win/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/model/build_info/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/model/conan_file/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/profile_loader/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/tools/oss/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /conans/test/unittests/model/editable_layout/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/paths/package_layouts/__init__.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conf/config_installer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/rest/rest_client_v1/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/unittests/client/rest/rest_client_v2/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/model/__init__.py: -------------------------------------------------------------------------------- 1 | from .conan_generator import Generator 2 | -------------------------------------------------------------------------------- /conans/test/functional/cross_building/profile_access/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /conans/test/functional/cross_building/graph/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.ci/jenkins/Jenkinsfile: -------------------------------------------------------------------------------- 1 | @Library('conan_ci') _ 2 | 3 | conanCI.runBuild(this) 4 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/data/.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt -text -diff 2 | -------------------------------------------------------------------------------- /conans/requirements_server.txt: -------------------------------------------------------------------------------- 1 | # Server 2 | bottle>=0.12.8, < 0.13 3 | pluginbase>=0.5, < 1.0 -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [pep8] 2 | count = False 3 | max-line-length = 100 4 | statistics = False 5 | 6 | -------------------------------------------------------------------------------- /conans/test/unittests/model/info/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | -------------------------------------------------------------------------------- /conans/unicode.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # FIXME: This has to be removed in Conan 2.0 4 | get_cwd = os.getcwd 5 | -------------------------------------------------------------------------------- /conans/test/functional/remote/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | CONAN_TEST_FOLDER = os.getenv('CONAN_TEST_FOLDER', None) 4 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/data/conanfile_utf8.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | zlib/1.2.11@conan/stable 3 | [generators] 4 | cmake -------------------------------------------------------------------------------- /conans/requirements_dev.txt: -------------------------------------------------------------------------------- 1 | nose>=1.3.7, <1.4.0 2 | parameterized>=0.6.3 3 | mock>=1.3.0, <1.4.0 4 | WebTest>=2.0.18, <2.1.0 5 | bottle 6 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/data/conanfile_utf8_with_bom.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | zlib/1.2.11@conan/stable 3 | [generators] 4 | cmake -------------------------------------------------------------------------------- /conans/build_info/__init__.py: -------------------------------------------------------------------------------- 1 | """Module for extract the JFrog Artifactory Build Info JSON from a conan tracer log: 2 | https://github.com/JFrogDev/build-info""" 3 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conf/detect/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 4 | -------------------------------------------------------------------------------- /conans/test/unittests/client/tools/os_info/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 4 | -------------------------------------------------------------------------------- /conans/conan.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | from conans.client.command import main 4 | 5 | 6 | def run(): 7 | main(sys.argv[1:]) 8 | 9 | 10 | if __name__ == '__main__': 11 | run() 12 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/hello/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(PackageTest CXX) 3 | 4 | add_library(hello hello.cpp) 5 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/data/conanfile_utf16be_with_bom.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ailisp/conan/develop/conans/test/unittests/client/util/files/data/conanfile_utf16be_with_bom.txt -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/data/conanfile_utf16le_with_bom.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ailisp/conan/develop/conans/test/unittests/client/util/files/data/conanfile_utf16le_with_bom.txt -------------------------------------------------------------------------------- /conans/client/build/__init__.py: -------------------------------------------------------------------------------- 1 | def defs_to_string(defs): 2 | return " ".join(['-D{0}="{1}"'.format(k, v) for k, v in defs.items()]) 3 | 4 | 5 | def join_arguments(args): 6 | return " ".join(filter(None, args)) 7 | -------------------------------------------------------------------------------- /conans/util/templates.py: -------------------------------------------------------------------------------- 1 | from jinja2 import Template 2 | 3 | 4 | def render_layout_file(content, ref=None, settings=None, options=None): 5 | t = Template(content) 6 | return t.render(reference=ref, settings=settings, options=options) 7 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/bye/src/bye.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef WIN32 4 | #define BYE_EXPORT __declspec(dllexport) 5 | #else 6 | #define BYE_EXPORT 7 | #endif 8 | 9 | BYE_EXPORT void bye(); 10 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/bye/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(PackageTest CXX) 3 | 4 | find_package(hello) 5 | add_library(bye bye.cpp) 6 | target_link_libraries(bye hello::hello) 7 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/hello/src/hello.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef WIN32 4 | #define HELLO_EXPORT __declspec(dllexport) 5 | #else 6 | #define HELLO_EXPORT 7 | #endif 8 | 9 | HELLO_EXPORT void hello(); 10 | -------------------------------------------------------------------------------- /conans/server/server_launcher.py: -------------------------------------------------------------------------------- 1 | from conans.server.launcher import ServerLauncher 2 | 3 | launcher = ServerLauncher() 4 | app = launcher.server.root_app 5 | 6 | 7 | def main(*args): 8 | launcher.launch() 9 | 10 | 11 | if __name__ == "__main__": 12 | main() 13 | -------------------------------------------------------------------------------- /conans/server/service/mime.py: -------------------------------------------------------------------------------- 1 | def get_mime_type(filepath): 2 | if filepath.endswith(".tgz"): 3 | mimetype = "x-gzip" 4 | elif filepath.endswith(".txz"): 5 | mimetype = "x-xz" 6 | else: 7 | mimetype = "auto" 8 | 9 | return mimetype 10 | -------------------------------------------------------------------------------- /conans/assets/templates/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from jinja2 import DictLoader 3 | 4 | import conans.assets.templates.search_table_html 5 | 6 | SEARCH_TABLE_HTML = 'output/search_table.html' 7 | 8 | 9 | dict_loader = DictLoader({ 10 | SEARCH_TABLE_HTML: search_table_html.content, 11 | }) 12 | -------------------------------------------------------------------------------- /conans/test/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import warnings 3 | 4 | CONAN_TEST_FOLDER = os.getenv('CONAN_TEST_FOLDER', None) 5 | os.environ["CONAN_RECIPE_LINTER"] = "False" 6 | 7 | # Enable warnings as errors only for `conan[s]` module 8 | # warnings.filterwarnings("error", module="(.*\.)?conans\..*") 9 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | 3 | [testenv] 4 | deps = -rconans/requirements_dev.txt 5 | commands = nosetests -A "not slow and not svn" [] # substitute with tox' positional arguments 6 | 7 | [testenv:full] 8 | deps = {[testenv]deps} 9 | commands = nosetests [] # substitute with tox' positional arguments 10 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/project_targets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(PackageTest CXX) 3 | 4 | 5 | set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) 6 | find_package(bye) 7 | add_executable(example example.cpp) 8 | target_link_libraries(example bye::bye) 9 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/hello/src/hello.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hello.h" 3 | 4 | void hello(){ 5 | #ifdef NDEBUG 6 | std::cout << "Hello World Release!" < 8 | 9 | - [ ] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md). -------------------------------------------------------------------------------- /conans/client/tools/android.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def to_android_abi(arch): 4 | """converts conan-style architecture into Android-NDK ABI""" 5 | return {'armv5': 'armeabi', 6 | 'armv6': 'armeabi-v6', 7 | 'armv7': 'armeabi-v7a', 8 | 'armv7hf': 'armeabi-v7a', 9 | 'armv8': 'arm64-v8a'}.get(str(arch), str(arch)) 10 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/bye/src/bye.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "bye.h" 3 | #include "hello.h" 4 | 5 | void bye(){ 6 | 7 | hello(); 8 | 9 | #ifdef NDEBUG 10 | std::cout << "bye World Release!" < 8 | 9 | - [ ] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md). 10 | -------------------------------------------------------------------------------- /conans/server/rest/controller/v2/__init__.py: -------------------------------------------------------------------------------- 1 | from conans.model.ref import ConanFileReference, PackageReference 2 | 3 | 4 | def get_package_ref(name, version, username, channel, package_id, revision, p_revision): 5 | ref = ConanFileReference(name, version, username, channel, revision) 6 | package_id = "%s#%s" % (package_id, p_revision) if p_revision else package_id 7 | return PackageReference(ref, package_id) 8 | -------------------------------------------------------------------------------- /conans/server/rest/bottle_routes.py: -------------------------------------------------------------------------------- 1 | from conans.model.rest_routes import RestRoutes 2 | 3 | 4 | class BottleRoutes(RestRoutes): 5 | 6 | def __getattribute__(self, item): 7 | tmp = super(BottleRoutes, self).__getattribute__(item) 8 | tmp = tmp.replace("{path}", "").replace("{", "<").replace("}", ">") 9 | if not tmp.startswith("/"): 10 | return "/{}".format(tmp) 11 | return tmp 12 | -------------------------------------------------------------------------------- /conans/util/dates.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from dateutil import parser 3 | 4 | 5 | def from_timestamp_to_iso8601(timestamp): 6 | return "%sZ" % datetime.datetime.utcfromtimestamp(int(timestamp)).isoformat() 7 | 8 | 9 | def from_iso8601_to_datetime(iso_str): 10 | return parser.isoparse(iso_str) 11 | 12 | 13 | def iso8601_to_str(iso_str): 14 | dt = from_iso8601_to_datetime(iso_str) 15 | return dt.strftime('%Y-%m-%d %H:%M:%S UTC') 16 | -------------------------------------------------------------------------------- /conans/client/generators/gcc.py: -------------------------------------------------------------------------------- 1 | from conans.client.generators.compiler_args import CompilerArgsGenerator 2 | from conans.paths import BUILD_INFO_GCC 3 | 4 | 5 | class GCCGenerator(CompilerArgsGenerator): 6 | """Backwards compatibility with 'gcc' generator, there the compiler was fixed to gcc always""" 7 | @property 8 | def filename(self): 9 | return BUILD_INFO_GCC 10 | 11 | @property 12 | def compiler(self): 13 | return "gcc" 14 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | plugins: 3 | pep8: 4 | enabled: true 5 | checks: 6 | file-lines: 7 | config: 8 | threshold: 5000 9 | argument-count: 10 | config: 11 | threshold: 10 12 | complex-logic: 13 | config: 14 | threshold: 100 15 | method-lines: 16 | config: 17 | threshold: 100 18 | method-count: 19 | config: 20 | threshold: 50 21 | method-complexity: 22 | config: 23 | threshold: 20 24 | -------------------------------------------------------------------------------- /conans/client/generators/virtualrunenv.py: -------------------------------------------------------------------------------- 1 | from conans.client.generators.virtualenv import VirtualEnvGenerator 2 | from conans.client.run_environment import RunEnvironment 3 | 4 | 5 | class VirtualRunEnvGenerator(VirtualEnvGenerator): 6 | 7 | suffix = "_run" 8 | venv_name = "conanrunenv" 9 | 10 | def __init__(self, conanfile): 11 | super(VirtualRunEnvGenerator, self).__init__(conanfile) 12 | run_env = RunEnvironment(conanfile) 13 | self.env = run_env.vars 14 | -------------------------------------------------------------------------------- /conans/test/utils/deprecation.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import warnings 4 | from contextlib import contextmanager 5 | 6 | 7 | @contextmanager 8 | def catch_deprecation_warning(test_suite, n=1): 9 | with warnings.catch_warnings(record=True) as w: 10 | warnings.filterwarnings("always", module="(.*\.)?conans\..*") 11 | yield 12 | if n: 13 | test_suite.assertEqual(len(w), n) 14 | test_suite.assertTrue(issubclass(w[0].category, DeprecationWarning)) 15 | -------------------------------------------------------------------------------- /conans/conan_server.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from conans.server.launcher import ServerLauncher 4 | 5 | 6 | def run(): 7 | parser = argparse.ArgumentParser(description='Launch the server') 8 | parser.add_argument('--migrate', default=False, action='store_true', 9 | help='Run the pending migrations') 10 | args = parser.parse_args() 11 | launcher = ServerLauncher(force_migration=args.migrate) 12 | launcher.launch() 13 | 14 | 15 | if __name__ == '__main__': 16 | run() 17 | -------------------------------------------------------------------------------- /conans/client/generators/virtualenv_python.py: -------------------------------------------------------------------------------- 1 | from conans.client.generators.virtualrunenv import VirtualRunEnvGenerator 2 | 3 | 4 | class VirtualEnvPythonGenerator(VirtualRunEnvGenerator): 5 | 6 | suffix = "_run_python" 7 | venv_name = "conanenvpython" 8 | 9 | def __init__(self, conanfile): 10 | super(VirtualEnvPythonGenerator, self).__init__(conanfile) 11 | ppath = conanfile.env.get("PYTHONPATH") 12 | if ppath: 13 | self.env.update({"PYTHONPATH": [ppath, ] if not isinstance(ppath, list) else ppath}) 14 | -------------------------------------------------------------------------------- /conans/server/rest/controller/common/ping.py: -------------------------------------------------------------------------------- 1 | from bottle import response 2 | 3 | from conans.server.rest.bottle_routes import BottleRoutes 4 | 5 | 6 | class PingController(object): 7 | 8 | @staticmethod 9 | def attach_to(app): 10 | r = BottleRoutes() 11 | 12 | @app.route(r.ping, method=["GET"]) 13 | def ping(): 14 | """ 15 | Response OK. Useful to get server capabilities 16 | """ 17 | response.headers['X-Conan-Server-Capabilities'] = ",".join(app.server_capabilities) 18 | return 19 | -------------------------------------------------------------------------------- /conans/test/unittests/util/read_only_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.test.utils.test_files import temp_folder 5 | from conans.util.files import load, make_read_only, save 6 | 7 | 8 | class ReadOnlyTest(unittest.TestCase): 9 | 10 | def read_only_test(self): 11 | folder = temp_folder() 12 | f = os.path.join(folder, "file.txt") 13 | save(f, "Hello World") 14 | make_read_only(folder) 15 | with self.assertRaises(IOError): 16 | save(f, "Bye World") 17 | self.assertEqual("Hello World", load(f)) -------------------------------------------------------------------------------- /conans/requirements.txt: -------------------------------------------------------------------------------- 1 | PyJWT>=1.4.0, <2.0.0 2 | requests>=2.8.1, <3.0.0 3 | urllib3!=1.25.4,!=1.25.5 4 | colorama>=0.3.3, <0.5.0 5 | PyYAML>=3.11, <6.0 6 | patch-ng>=1.17.4, <1.18 7 | fasteners>=0.14.1 8 | six>=1.10.0,<=1.14.0 9 | node-semver==0.6.1 10 | distro>=1.0.2, <1.2.0 11 | future>=0.16.0, <0.19.0 12 | pygments>=2.0, <3.0 13 | deprecation>=2.0, <2.1 14 | tqdm>=4.28.1, <5 15 | Jinja2>=2.3, <3 16 | python-dateutil>=2.7.0, <3 17 | idna==2.6 ; sys_platform == "darwin" # Solving conflict, somehow is installing 2.7 when requests require 2.6 18 | cryptography>=1.3.4, <2.4.0 ; sys_platform == "darwin" 19 | pyOpenSSL>=16.0.0, <19.0.0 ; sys_platform == "darwin" 20 | 21 | -------------------------------------------------------------------------------- /conans/test/functional/graph/version_range_error_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.paths import CONANFILE 4 | from conans.test.utils.tools import TestClient, GenConanfile 5 | 6 | 7 | class VersionRangesErrorTest(unittest.TestCase): 8 | def verbose_version_test(self): 9 | client = TestClient() 10 | conanfile = GenConanfile().with_name("MyPkg").with_version("0.1")\ 11 | .with_require_plain("MyOtherPkg/[~0.1]@user/testing") 12 | client.save({CONANFILE: str(conanfile)}) 13 | client.run("install . --build", assert_error=True) 14 | self.assertIn("from requirement 'MyOtherPkg/[~0.1]@user/testing'", client.out) 15 | -------------------------------------------------------------------------------- /conans/server/service/user_service.py: -------------------------------------------------------------------------------- 1 | from conans.errors import AuthenticationException 2 | 3 | 4 | class UserService(object): 5 | 6 | def __init__(self, authenticator, credentials_manager): 7 | self.authenticator = authenticator 8 | self.credentials_manager = credentials_manager 9 | 10 | def authenticate(self, username, password): 11 | valid = self.authenticator.valid_user(username, password) 12 | 13 | # If user is valid returns a token 14 | if valid: 15 | token = self.credentials_manager.get_token_for(username) 16 | return token 17 | else: 18 | raise AuthenticationException("Wrong user or password") 19 | -------------------------------------------------------------------------------- /conans/test/functional/conan_api/config_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.client import conan_api 4 | 5 | 6 | class ConfigTest(unittest.TestCase): 7 | 8 | def setUp(self): 9 | self.api, _, _ = conan_api.ConanAPIV1.factory() 10 | 11 | def config_rm_test(self): 12 | self.api.config_set("proxies.https", "http://10.10.1.10:1080") 13 | self.assertIn("proxies", self.api.app.config.sections()) 14 | self.api.config_rm('proxies') 15 | self.assertNotIn("proxies", self.api.app.config.sections()) 16 | 17 | def test_config_home(self): 18 | conan_home = self.api.config_home() 19 | self.assertEqual(self.api.cache_folder, conan_home) 20 | -------------------------------------------------------------------------------- /conans/test/conan_v2/conanfile/test_collect_libs.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | 3 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 4 | 5 | 6 | class CollectLibsTestCase(ConanV2ModeTestCase): 7 | 8 | def test_self_collect_libs(self): 9 | t = self.get_client() 10 | conanfile = textwrap.dedent(""" 11 | from conans import ConanFile 12 | 13 | class Recipe(ConanFile): 14 | def package_info(self): 15 | libs = self.collect_libs() 16 | """) 17 | t.save({'conanfile.py': conanfile}) 18 | t.run('create . name/version@', assert_error=True) 19 | self.assertIn("Conan v2 incompatible: 'self.collect_libs' is deprecated", t.out) 20 | -------------------------------------------------------------------------------- /conans/test/unittests/client/util/files/load_test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import unittest 5 | 6 | from parameterized import parameterized 7 | 8 | from conans.util.files import load 9 | 10 | 11 | class LoadTest(unittest.TestCase): 12 | 13 | @parameterized.expand([("conanfile_utf8.txt",), 14 | ("conanfile_utf8_with_bom.txt",), 15 | ("conanfile_utf16le_with_bom.txt",), 16 | ("conanfile_utf16be_with_bom.txt",)]) 17 | def test_encoding(self, filename): 18 | path = os.path.join(os.path.dirname(__file__), "data", filename) 19 | contents = load(path) 20 | self.assertTrue(contents.startswith("[requires]")) 21 | -------------------------------------------------------------------------------- /.github/PR_INCREASE_TESTING.md: -------------------------------------------------------------------------------- 1 | Increasing testing level in the Pull Requests 2 | ============================================= 3 | 4 | By default the PRs will skip the slower tests and will use a limited set of python versions. 5 | Use the following tags in the body of the Pull Request: 6 | 7 | ``` 8 | #PYVERS: Macos@py27, Windows@py36, Linux@py27, py34 9 | #TAGS: svn, slow 10 | #REVISIONS: 1 11 | ``` 12 | 13 | - **#PYVERS** adds new python versions to the slaves, it can be scoped to a slave with a @ (Macos, Windows, Linux) or 14 | global for all. 15 | - **#TAGS** adds tags (removes the excluded, by default "slow" and "svn" are excluded. Add them to run all tests). 16 | - **#REVISIONS** enable the three revisions stages, can be '1' or 'True'. 17 | -------------------------------------------------------------------------------- /conans/test/conan_v2/test_cppinfo.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | 3 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 4 | 5 | 6 | class CppinfoCppflagsTestCase(ConanV2ModeTestCase): 7 | 8 | def test_deprecate_cppflags(self): 9 | t = self.get_client() 10 | conanfile = textwrap.dedent(""" 11 | from conans import ConanFile 12 | 13 | class Recipe(ConanFile): 14 | def package_info(self): 15 | self.cpp_info.cppflags = "aa" 16 | """) 17 | t.save({'conanfile.py': conanfile}) 18 | t.run('create . name/version@', assert_error=True) 19 | self.assertIn("Conan v2 incompatible: 'cpp_info.cppflags' is deprecated, use 'cxxflags' instead", t.out) 20 | -------------------------------------------------------------------------------- /conans/test/conan_v2/tools/test_tools_win.py: -------------------------------------------------------------------------------- 1 | import six 2 | 3 | from conans import tools 4 | from conans.errors import ConanV2Exception 5 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 6 | 7 | 8 | class ToolsWinTestCase(ConanV2ModeTestCase): 9 | def test_msvc_build_command(self): 10 | with six.assertRaisesRegex(self, ConanV2Exception, "Conan v2 incompatible: 'tools.msvc_build_command' is deprecated"): 11 | tools.msvc_build_command(settings=None, sln_path=None) 12 | 13 | def test_build_sln_command(self): 14 | with six.assertRaisesRegex(self, ConanV2Exception, "Conan v2 incompatible: 'tools.build_sln_command' is deprecated"): 15 | tools.build_sln_command(settings=None, sln_path=None) 16 | -------------------------------------------------------------------------------- /conans/test/conan_v2/conanfile/test_config_method.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | 3 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 4 | 5 | 6 | class ConfigMethodTestCase(ConanV2ModeTestCase): 7 | 8 | def test_config_method(self): 9 | t = self.get_client() 10 | conanfile = textwrap.dedent(""" 11 | from conans import ConanFile 12 | 13 | class Recipe(ConanFile): 14 | def config(self): 15 | pass 16 | """) 17 | t.save({'conanfile.py': conanfile}) 18 | t.run('create . name/version@', assert_error=True) 19 | self.assertIn("Conan v2 incompatible: config() has been deprecated. Use config_options() and configure()", 20 | t.out) 21 | -------------------------------------------------------------------------------- /conans/client/tools/__init__.py: -------------------------------------------------------------------------------- 1 | # noinspection PyUnresolvedReferences 2 | from .android import * 3 | # noinspection PyUnresolvedReferences 4 | from .apple import * 5 | # noinspection PyUnresolvedReferences 6 | from .env import * 7 | # noinspection PyUnresolvedReferences 8 | from .files import * 9 | # noinspection PyUnresolvedReferences 10 | from .net import * 11 | # noinspection PyUnresolvedReferences 12 | from .oss import * 13 | # noinspection PyUnresolvedReferences 14 | from .pkg_config import * 15 | # noinspection PyUnresolvedReferences 16 | from .scm import * 17 | # noinspection PyUnresolvedReferences 18 | from .settings import * 19 | # noinspection PyUnresolvedReferences 20 | from .system_pm import * 21 | # noinspection PyUnresolvedReferences 22 | from .win import * 23 | -------------------------------------------------------------------------------- /.ci/bump_dev_version.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | 5 | def replace_in_file(file_path, search, replace): 6 | with open(file_path, "r") as handle: 7 | content = handle.read() 8 | if search not in content: 9 | raise Exception("Incorrect development version in conans/__init__.py") 10 | content = content.replace(search, replace) 11 | content = content.encode("utf-8") 12 | with open(file_path, "wb") as handle: 13 | handle.write(content) 14 | 15 | def bump_dev(): 16 | vfile = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../conans/__init__.py") 17 | snapshot = "%s" % int(time.time()) 18 | replace_in_file(vfile, "-dev'", "-dev%s'" % snapshot) 19 | 20 | 21 | if __name__ == "__main__": 22 | bump_dev() 23 | -------------------------------------------------------------------------------- /conans/client/conanfile/build.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from conans.errors import conanfile_exception_formatter 4 | from conans.model.conan_file import get_env_context_manager 5 | from conans.util.log import logger 6 | 7 | 8 | def run_build_method(conanfile, hook_manager, **hook_kwargs): 9 | hook_manager.execute("pre_build", conanfile=conanfile, **hook_kwargs) 10 | 11 | logger.debug("Call conanfile.build() with files in build folder: %s", 12 | os.listdir(conanfile.build_folder)) 13 | with get_env_context_manager(conanfile): 14 | conanfile.output.highlight("Calling build()") 15 | with conanfile_exception_formatter(str(conanfile), "build"): 16 | conanfile.build() 17 | 18 | hook_manager.execute("post_build", conanfile=conanfile, **hook_kwargs) 19 | -------------------------------------------------------------------------------- /conans/test/functional/ui/exit_with_code_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.paths import CONANFILE 4 | from conans.test.utils.tools import TestClient 5 | 6 | 7 | class ExitWithCodeTest(unittest.TestCase): 8 | 9 | def raise_an_error_test(self): 10 | 11 | base = ''' 12 | import sys 13 | from conans import ConanFile 14 | 15 | class HelloConan(ConanFile): 16 | name = "Hello0" 17 | version = "0.1" 18 | 19 | def build(self): 20 | sys.exit(34) 21 | ''' 22 | 23 | client = TestClient() 24 | files = {CONANFILE: base} 25 | client.save(files) 26 | client.run("install .") 27 | error_code = client.run("build .", assert_error=True) 28 | self.assertEqual(error_code, 34) 29 | self.assertIn("Exiting with code: 34", client.out) 30 | -------------------------------------------------------------------------------- /conans/util/fallbacks.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import warnings 4 | 5 | 6 | def default_output(output, fn_name=None): 7 | if output is None: 8 | fn_str = " to function '{}'".format(fn_name) if fn_name else '' 9 | warnings.warn("Provide the output argument explicitly{}".format(fn_str)) 10 | 11 | from conans.tools import _global_output 12 | return _global_output 13 | 14 | return output 15 | 16 | 17 | def default_requester(requester, fn_name=None): 18 | if requester is None: 19 | fn_str = " to function '{}'".format(fn_name) if fn_name else '' 20 | warnings.warn("Provide the requester argument explicitly{}".format(fn_str)) 21 | 22 | from conans.tools import _global_requester 23 | return _global_requester 24 | 25 | return requester 26 | -------------------------------------------------------------------------------- /conans/server/migrate.py: -------------------------------------------------------------------------------- 1 | from conans import __version__ as SERVER_VERSION 2 | from conans.model.version import Version 3 | from conans.server.conf import ConanServerConfigParser 4 | from conans.server.migrations import ServerMigrator 5 | from conans.util.log import logger 6 | 7 | 8 | def migrate_and_get_server_config(base_folder, force_migration=False): 9 | server_config = ConanServerConfigParser(base_folder) 10 | storage_path = server_config.disk_storage_path 11 | migrator = ServerMigrator(server_config.conan_folder, storage_path, 12 | Version(SERVER_VERSION), logger, force_migration) 13 | migrator.migrate() 14 | 15 | # Init again server_config, migrator could change something 16 | server_config = ConanServerConfigParser(base_folder) 17 | return server_config 18 | -------------------------------------------------------------------------------- /conans/server/plugin_loader.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | def load_authentication_plugin(server_folder, plugin_name): 5 | try: 6 | from pluginbase import PluginBase 7 | plugin_base = PluginBase(package="plugins/authenticator") 8 | plugins_dir = os.path.join(server_folder, "plugins", "authenticator") 9 | plugin_source = plugin_base.make_plugin_source( 10 | searchpath=[plugins_dir]) 11 | auth = plugin_source.load_plugin(plugin_name).get_class() 12 | # it is necessary to keep a reference to the plugin, otherwise it is removed 13 | # and some imports fail 14 | auth.plugin_source = plugin_source 15 | return auth 16 | except Exception: 17 | print("Error loading authenticator plugin '%s'" % plugin_name) 18 | raise 19 | -------------------------------------------------------------------------------- /conans/test/conan_v2/test_python_requires.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | 3 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 4 | 5 | 6 | class PythonRequiresTestCase(ConanV2ModeTestCase): 7 | 8 | def test_deprecate_old_syntax(self): 9 | # It raises if used, not if it is just imported 10 | t = self.get_client() 11 | conanfile = textwrap.dedent(""" 12 | from conans import ConanFile, python_requires 13 | 14 | base = python_requires("pyreq/version@user/channel") 15 | class Recipe(ConanFile): 16 | pass 17 | """) 18 | t.save({'conanfile.py': conanfile}) 19 | t.run('export . name/version@', assert_error=True) 20 | self.assertIn("Conan v2 incompatible: Old syntax for python_requires is deprecated", t.out) 21 | -------------------------------------------------------------------------------- /conans/test/functional/conanfile/cpp_info_scope_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.test.utils.tools import TestClient 4 | 5 | 6 | class CppInfoScopeTest(unittest.TestCase): 7 | 8 | def cpp_info_scope_test(self): 9 | client = TestClient() 10 | conanfile = """from conans import ConanFile 11 | class TestConan(ConanFile): 12 | def package(self): 13 | self.cpp_info.includedirs = ["inc"] 14 | """ 15 | client.save({"conanfile.py": conanfile}) 16 | client.run("create . Pkg/0.1@lasote/channel", assert_error=True) 17 | self.assertIn("ERROR: Pkg/0.1@lasote/channel: Error in package() method, line 4", 18 | client.out) 19 | self.assertIn("AttributeError: 'NoneType' object has no attribute 'includedirs'", 20 | client.out) 21 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conf/detect/test_gcc_compiler.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import mock 4 | from parameterized import parameterized 5 | 6 | from conans.client.conf.detect import _gcc_compiler 7 | from conans.test.utils.tools import TestBufferConanOutput 8 | 9 | 10 | class GCCCompilerTestCase(unittest.TestCase): 11 | 12 | @parameterized.expand([("10",), ("4.2",), ('7', )]) 13 | def test_detect_gcc_10(self, version): 14 | output = TestBufferConanOutput() 15 | with mock.patch("platform.system", return_value="Linux"): 16 | with mock.patch("conans.client.conf.detect.detect_runner", return_value=(0, version)): 17 | compiler, installed_version = _gcc_compiler(output) 18 | self.assertEqual(compiler, 'gcc') 19 | self.assertEqual(installed_version, version) 20 | -------------------------------------------------------------------------------- /conans/test/unittests/util/android_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.client import tools 4 | 5 | 6 | class AndroidTest(unittest.TestCase): 7 | def test_to_android_abi(self): 8 | self.assertEqual(tools.to_android_abi('x86'), 'x86') 9 | self.assertEqual(tools.to_android_abi('x86_64'), 'x86_64') 10 | self.assertEqual(tools.to_android_abi('armv5'), 'armeabi') 11 | self.assertEqual(tools.to_android_abi('armv6'), 'armeabi-v6') 12 | self.assertEqual(tools.to_android_abi('armv7'), 'armeabi-v7a') 13 | self.assertEqual(tools.to_android_abi('armv7hf'), 'armeabi-v7a') 14 | self.assertEqual(tools.to_android_abi('armv8'), 'arm64-v8a') 15 | self.assertEqual(tools.to_android_abi('mips'), 'mips') 16 | self.assertEqual(tools.to_android_abi('mips64'), 'mips64') 17 | -------------------------------------------------------------------------------- /conans/server/crypto/jwt/jwt_credentials_manager.py: -------------------------------------------------------------------------------- 1 | from conans.server.crypto.jwt.jwt_manager import JWTManager 2 | 3 | 4 | class JWTCredentialsManager(JWTManager): 5 | """JWT for manage auth credentials""" 6 | 7 | def __init__(self, secret, expire_time): 8 | super(JWTCredentialsManager, self).__init__(secret, expire_time) 9 | 10 | def get_token_for(self, brl_user): 11 | """Generates a token with the brl_user and additional data dict if needed""" 12 | return JWTManager.get_token_for(self, {"user": brl_user}) 13 | 14 | def get_user(self, token): 15 | """Gets the user from credentials object. None if no credentials. 16 | Can raise jwt.ExpiredSignature and jwt.DecodeError""" 17 | profile = self.get_profile(token) 18 | username = profile.get("user", None) 19 | return username 20 | -------------------------------------------------------------------------------- /conans/test/functional/tools/cpu_count_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.paths import CONANFILE 4 | from conans.test.utils.tools import TestClient 5 | 6 | conanfile = """ 7 | from conans import ConanFile, tools 8 | 9 | class AConan(ConanFile): 10 | name = "Hello0" 11 | version = "0.1" 12 | 13 | def build(self): 14 | self.output.warn("CPU COUNT=> %s" % tools.cpu_count()) 15 | 16 | """ 17 | 18 | 19 | class CPUCountTest(unittest.TestCase): 20 | 21 | def cpu_count_override_test(self): 22 | self.client = TestClient() 23 | self.client.save({CONANFILE: conanfile}) 24 | self.client.run("config set general.cpu_count=5") 25 | self.client.run("export . lasote/stable") 26 | self.client.run("install Hello0/0.1@lasote/stable --build missing") 27 | self.assertIn("CPU COUNT=> 5", self.client.out) 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Bug Report' 3 | about: 'Report a bug, something does not work as it supposed to' 4 | title: '[bug] SHORT DESCRIPTION' 5 | --- 6 | 7 | 13 | 14 | ### Environment Details (include every applicable attribute) 15 | * Operating System+version: 16 | * Compiler+version: 17 | * Conan version: 18 | * Python version: 19 | 20 | ### Steps to reproduce (Include if Applicable) 21 | 22 | 23 | ### Logs (Executed commands with output) (Include/Attach if Applicable) 24 | 25 | 30 | -------------------------------------------------------------------------------- /conans/test/unittests/client/userio_test.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import unittest 4 | 5 | from mock import mock 6 | 7 | from conans.client.userio import UserIO 8 | 9 | 10 | class UserIOTest(unittest.TestCase): 11 | 12 | @mock.patch("conans.client.userio.UserIO.get_username", return_value="username") 13 | @mock.patch("conans.client.userio.UserIO.get_password", return_value="passwd") 14 | def test_request_login(self, m1, m2): 15 | user_io = UserIO() 16 | 17 | # Use mocked ones 18 | u, p = user_io.request_login(remote_name="lol") 19 | self.assertEqual(u, "username") 20 | self.assertEqual(p, "passwd") 21 | 22 | # Use from argument 23 | username = "it's me!" 24 | u, p = user_io.request_login(remote_name="lol", username=username) 25 | self.assertEqual(u, username) 26 | self.assertEqual(p, "passwd") 27 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Changelog: (Feature | Fix | Bugfix): Describe here your pull request 2 | Docs: https://github.com/conan-io/docs/pull/XXXX 3 | 4 | - [ ] Refer to the issue that supports this Pull Request. 5 | - [ ] If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request. 6 | - [ ] I've read the [Contributing guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md). 7 | - [ ] I've followed the PEP8 style guides for Python code. 8 | - [ ] I've opened another PR in the Conan docs repo to the ``develop`` branch, documenting this one. 9 | 10 | **Note:** By default this PR will skip the slower tests and will use a limited set of python versions. Check [here](https://github.com/conan-io/conan/blob/develop/.github/PR_INCREASE_TESTING.md) how to increase the testing level by writing some tags in the current PR body text. 11 | -------------------------------------------------------------------------------- /conans/test/conan_v2/conanfile/test_package_method.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | 3 | from conans.test.utils.conan_v2_tests import ConanV2ModeTestCase 4 | 5 | 6 | class ConanfileSourceTestCase(ConanV2ModeTestCase): 7 | """ Conan v2: 'self.info' is not available in 'package()' """ 8 | 9 | def test_info_not_in_package(self): 10 | # self.info is not available in 'package' 11 | t = self.get_client() 12 | conanfile = textwrap.dedent(""" 13 | from conans import ConanFile 14 | 15 | class Recipe(ConanFile): 16 | 17 | def package(self): 18 | self.info.header_only() 19 | """) 20 | t.save({'conanfile.py': conanfile}) 21 | t.run('create . name/version@ -s os=Linux', assert_error=True) 22 | self.assertIn("Conan v2 incompatible: 'self.info' access in package() method is deprecated", t.out) 23 | -------------------------------------------------------------------------------- /conans/test/unittests/model/values_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.model.values import Values 4 | 5 | 6 | class ValuesTest(unittest.TestCase): 7 | 8 | def simple_test(self): 9 | v = Values() 10 | self.assertEqual(v.compiler, None) 11 | v.compiler = 3 12 | self.assertTrue(v.compiler == "3") 13 | 14 | self.assertEqual(v.compiler.version, None) 15 | v.compiler.version = "asfaf" 16 | self.assertEqual(v.compiler.version, "asfaf") 17 | 18 | my_list = v.as_list() 19 | self.assertEqual(my_list, [('compiler', '3'), 20 | ('compiler.version', 'asfaf')]) 21 | 22 | values = Values.from_list(my_list) 23 | self.assertEqual(values.dumps(), v.dumps()) 24 | 25 | v.compiler = None 26 | self.assertEqual(v.as_list(), [('compiler', 'None')]) 27 | self.assertEqual(v.dumps(), "compiler=None") 28 | -------------------------------------------------------------------------------- /conans/model/user_info.py: -------------------------------------------------------------------------------- 1 | from collections import defaultdict 2 | 3 | 4 | class UserInfo(object): 5 | """ Class to be able to assign properties to a dict""" 6 | 7 | def __init__(self): 8 | self._values_ = {} 9 | 10 | def __getattr__(self, name): 11 | if name.startswith("_") and name.endswith("_"): 12 | return super(UserInfo, self).__getattr__(name) 13 | 14 | return self._values_[name] 15 | 16 | def __setattr__(self, name, value): 17 | if name.startswith("_") and name.endswith("_"): 18 | return super(UserInfo, self).__setattr__(name, value) 19 | self._values_[name] = str(value) 20 | 21 | def __repr__(self): 22 | return str(self._values_) 23 | 24 | @property 25 | def vars(self): 26 | return self._values_ 27 | 28 | 29 | class DepsUserInfo(defaultdict): 30 | def __init__(self): 31 | super(DepsUserInfo, self).__init__(UserInfo) 32 | -------------------------------------------------------------------------------- /conans/test/utils/profiles.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from conans.model.options import OptionsValues 4 | from conans.model.profile import Profile 5 | from conans.util.files import save 6 | 7 | 8 | def create_profile(folder, name, settings=None, package_settings=None, env=None, 9 | package_env=None, options=None): 10 | 11 | package_env = package_env or {} 12 | 13 | profile = Profile() 14 | profile.settings = settings or {} 15 | 16 | if package_settings: 17 | profile.package_settings = package_settings 18 | 19 | if options: 20 | profile.options = OptionsValues(options) 21 | 22 | for package_name, envs in package_env.items(): 23 | for var_name, value in envs: 24 | profile.env_values.add(var_name, value, package_name) 25 | 26 | for var_name, value in env or {}: 27 | profile.env_values.add(var_name, value) 28 | 29 | save(os.path.join(folder, name), profile.dumps()) 30 | -------------------------------------------------------------------------------- /conans/client/rest/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | def response_to_str(response): 5 | content = response.content 6 | try: 7 | # A bytes message, decode it as str 8 | if isinstance(content, bytes): 9 | content = content.decode() 10 | 11 | content_type = response.headers.get("content-type") 12 | 13 | if content_type == "application/json": 14 | # Errors from Artifactory looks like: 15 | # {"errors" : [ {"status" : 400, "message" : "Bla bla bla"}]} 16 | try: 17 | data = json.loads(content)["errors"][0] 18 | content = "{}: {}".format(data["status"], data["message"]) 19 | except Exception: 20 | pass 21 | elif "text/html" in content_type: 22 | content = "{}: {}".format(response.status_code, response.reason) 23 | 24 | return content 25 | 26 | except Exception: 27 | return response.content 28 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/hello/conanfile.py: -------------------------------------------------------------------------------- 1 | from conans import ConanFile, CMake 2 | 3 | 4 | class HelloConan(ConanFile): 5 | name = "hello" 6 | version = "1.0" 7 | settings = "os", "compiler", "arch", "build_type" 8 | options = {"shared": [True, False]} 9 | default_options = "shared=False" 10 | exports_sources = "src/*" 11 | 12 | def build(self): 13 | cmake = CMake(self) 14 | cmake.configure(source_folder="src") 15 | cmake.build() 16 | 17 | def package(self): 18 | self.copy("*.h", dst="include", keep_path=False) 19 | self.copy("*.lib", dst="lib", keep_path=False) 20 | self.copy("*.dll", dst="bin", keep_path=False) 21 | self.copy("*.so", dst="lib", keep_path=False) 22 | self.copy("*.dylib", dst="lib", keep_path=False) 23 | self.copy("*.a", dst="lib", keep_path=False) 24 | 25 | def package_info(self): 26 | self.cpp_info.libs.append("hello") 27 | -------------------------------------------------------------------------------- /conans/test/utils/conan_v2_tests.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.client.conf import get_default_settings_yml 5 | from conans.client.tools import environment_append 6 | from conans.test.utils.tools import TestClient 7 | from conans.util.conan_v2_mode import CONAN_V2_MODE_ENVVAR 8 | from conans.client.cache.cache import CONAN_SETTINGS 9 | 10 | 11 | class ConanV2ModeTestCase(unittest.TestCase): 12 | 13 | @staticmethod 14 | def get_client(use_settings_v1=False, *args, **kwargs): 15 | # TODO: Initialize with the default behavior for Conan v2 16 | t = TestClient(*args, **kwargs) 17 | if use_settings_v1: 18 | t.save({os.path.join(t.cache_folder, CONAN_SETTINGS): 19 | get_default_settings_yml(force_v1=True)}) 20 | return t 21 | 22 | def run(self, *args, **kwargs): 23 | with environment_append({CONAN_V2_MODE_ENVVAR: "1"}): 24 | super(ConanV2ModeTestCase, self).run(*args, **kwargs) 25 | -------------------------------------------------------------------------------- /conans/test/unittests/client/remote_manager_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.client.cmd.uploader import compress_files 5 | from conans.paths import PACKAGE_TGZ_NAME 6 | from conans.test.utils.test_files import temp_folder 7 | from conans.util.files import save 8 | 9 | 10 | class RemoteManagerTest(unittest.TestCase): 11 | 12 | def test_compress_files(self): 13 | folder = temp_folder() 14 | save(os.path.join(folder, "one_file.txt"), b"The contents") 15 | save(os.path.join(folder, "Two_file.txt"), b"Two contents") 16 | 17 | files = { 18 | "one_file.txt": os.path.join(folder, "one_file.txt"), 19 | "Two_file.txt": os.path.join(folder, "Two_file.txt"), 20 | } 21 | 22 | path = compress_files(files, {}, PACKAGE_TGZ_NAME, dest_dir=folder) 23 | self.assertTrue(os.path.exists(path)) 24 | expected_path = os.path.join(folder, PACKAGE_TGZ_NAME) 25 | self.assertEqual(path, expected_path) 26 | -------------------------------------------------------------------------------- /conans/test/unittests/util/local_db_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.client.store.localdb import LocalDB 5 | from conans.test.utils.test_files import temp_folder 6 | 7 | 8 | class LocalStoreTest(unittest.TestCase): 9 | 10 | def localdb_test(self): 11 | tmp_dir = temp_folder() 12 | db_file = os.path.join(tmp_dir, "dbfile") 13 | localdb = LocalDB.create(db_file) 14 | 15 | # Test write and read login 16 | user, token, access_token = localdb.get_login("myurl1") 17 | self.assertIsNone(user) 18 | self.assertIsNone(token) 19 | self.assertIsNone(access_token) 20 | 21 | localdb.store("pepe", "token", "access_token", "myurl1") 22 | user, token, access_token = localdb.get_login("myurl1") 23 | self.assertEqual("pepe", user) 24 | self.assertEqual("token", token) 25 | self.assertEqual("access_token", access_token) 26 | self.assertEqual("pepe", localdb.get_username("myurl1")) 27 | -------------------------------------------------------------------------------- /contributors.txt: -------------------------------------------------------------------------------- 1 | Contributors 2 | ------------- 3 | 4 | This is the list of contributors to this project source code, in alphabetical order. 5 | Many thanks to all of them! 6 | 7 | - Bocanegra Algarra, Raul (raul.bocanegra.algarra@gmail.com) 8 | - Cicholewski, Adrian (et666@t-online.de) 9 | - Dauphin, Loïc (astralien3000@yahoo.fr, @astralien3000) 10 | - Díaz Más, Luis (piponazo@gmail, @pipotux) 11 | - Dragly, Svenn-Arne (dragly.org) 12 | - Ford, Andrew (andrewford55139@gmail.com) 13 | - Hieta, Tobias (tobias@plex.tv, @tobiashieta) 14 | - Hochstedler, Reid 15 | - Ivek, Tomislav (tomislav.ivek@gmail.com, @tomivek) 16 | - Koch, Marco (marco-koch@t-online.de, @MarcoKoch) 17 | - Kourkoulis, Dimitri (@dimi309) 18 | - Lee, Jeongseok (jslee02@gmail.com, @jslee02) 19 | - Lord, Matthew( @luckielordie ) 20 | - Márki, Róbert (gsmiko@gmail.com, @robertmrk) 21 | - Ray, Chris (chris@xaltotun.com) 22 | - Ries, Uilian (uilianries@gmail.com, @uilianries) 23 | - Sechet, Olivier (osechet@gmail.com) 24 | - Sturm, Fabian (f@rtfs.org, @sturmf) 25 | -------------------------------------------------------------------------------- /conans/test/unittests/util/env_reader_test.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | import mock 3 | import unittest 4 | 5 | from conans.util.env_reader import get_env 6 | 7 | 8 | class GetEnvTest(unittest.TestCase): 9 | environment = {"EMPTY_LIST": "", 10 | "LIST": "a,b,c,d"} 11 | 12 | def test_environment(self): 13 | """ Ensure that we are using os.environment if no argument is passed """ 14 | with mock.patch("os.environ.get", return_value="zzz"): 15 | a = get_env("whatever", default=None) 16 | self.assertEqual(a, "zzz") 17 | 18 | def test_list_empty(self): 19 | r = get_env("EMPTY_LIST", default=list(), environment=self.environment) 20 | self.assertEqual(r, []) 21 | 22 | r = get_env("NON-EXISTING-LIST", default=list(), environment=self.environment) 23 | self.assertEqual(r, []) 24 | 25 | def test_list(self): 26 | r = get_env("LIST", default=list(), environment=self.environment) 27 | self.assertEqual(r, ["a", "b", "c", "d"]) 28 | -------------------------------------------------------------------------------- /conans/build_info/model.py: -------------------------------------------------------------------------------- 1 | from collections import namedtuple 2 | 3 | import conans 4 | 5 | 6 | class BuildInfo(object): 7 | 8 | def __init__(self): 9 | self.modules = [] 10 | 11 | def serialize(self): 12 | return {"modules": [module.serialize() for module in self.modules], 13 | "buildAgent": {"name": "Conan", "version": conans.__version__}} 14 | 15 | 16 | class BuildInfoModule(object): 17 | 18 | def __init__(self): 19 | # Conan package or recipe 20 | self.id = "" 21 | self.artifacts = [] 22 | self.dependencies = [] 23 | 24 | def serialize(self): 25 | return {"id": self.id, 26 | "artifacts": [ar._asdict() for ar in self.artifacts], 27 | "dependencies": [dep._asdict() for dep in self.dependencies]} 28 | 29 | 30 | BuildInfoModuleArtifact = namedtuple("BuildInfoModuleArtifact", ['type', 'sha1', 'md5', 'name']) 31 | BuildInfoModuleDependency = namedtuple('BuildInfoModuleDependency', ['id', 'type', 'sha1', 'md5']) 32 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conan_output_test.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import unittest 4 | from types import MethodType 5 | 6 | from six import StringIO 7 | 8 | from conans.client.output import ConanOutput 9 | from mock import mock 10 | 11 | 12 | class ConanOutputTest(unittest.TestCase): 13 | 14 | def test_blocked_output(self): 15 | # https://github.com/conan-io/conan/issues/4277 16 | stream = StringIO() 17 | 18 | def write_raise(self, data): 19 | write_raise.counter = getattr(write_raise, "counter", 0) + 1 20 | if write_raise.counter < 2: 21 | raise IOError("Stdout locked") 22 | self.super_write(data) 23 | stream.super_write = stream.write 24 | stream.write = MethodType(write_raise, stream) 25 | out = ConanOutput(stream) 26 | 27 | with mock.patch("time.sleep") as sleep: 28 | out.write("Hello world") 29 | sleep.assert_any_call(0.02) 30 | self.assertEqual("Hello world", stream.getvalue()) 31 | -------------------------------------------------------------------------------- /conans/test/functional/cache/rmdir_fail_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import platform 3 | import unittest 4 | 5 | from conans.model.ref import ConanFileReference 6 | from conans.test.utils.tools import TestClient, GenConanfile 7 | 8 | 9 | class RMdirFailTest(unittest.TestCase): 10 | 11 | @unittest.skipIf(platform.system() != "Windows", "needs windows") 12 | def fail_rmdir_test(self): 13 | client = TestClient() 14 | client.save({"conanfile.py": GenConanfile()}) 15 | client.run("create . MyPkg/0.1@lasote/testing") 16 | ref = ConanFileReference.loads("MyPkg/0.1@lasote/testing") 17 | builds = client.cache.package_layout(ref).builds() 18 | build_folder = os.listdir(builds)[0] 19 | build_folder = os.path.join(builds, build_folder) 20 | f = open(os.path.join(build_folder, "myfile"), "wb") 21 | f.write(b"Hello world") 22 | client.run("install MyPkg/0.1@lasote/testing --build", assert_error=True) 23 | self.assertIn("Couldn't remove folder, might be busy or open", client.out) 24 | -------------------------------------------------------------------------------- /conans/test/functional/configuration/python_version_test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | import six 4 | import unittest 5 | 6 | from conans.test.utils.tools import TestClient 7 | 8 | 9 | class PythonVersionTest(unittest.TestCase): 10 | 11 | def setUp(self): 12 | self.client = TestClient() 13 | 14 | def _validate_message(self, expected_message): 15 | self.client.run("--help") 16 | self.assertIn(expected_message, str(self.client.out)) 17 | 18 | @unittest.skipUnless(six.PY2, "Requires Python 2.7") 19 | def test_py2_warning_message(self): 20 | self._validate_message("Python 2 is deprecated as of 01/01/2020 and Conan has stopped\n" 21 | "supporting it officially") 22 | 23 | @unittest.skipUnless(sys.version_info.major == 3 and sys.version_info.minor == 4, "Requires Python 3.4") 24 | def test_py34_warning_message(self): 25 | self._validate_message("Python 3.4 support has been dropped. It is strongly " 26 | "recommended to use Python >= 3.5 with Conan") 27 | -------------------------------------------------------------------------------- /conans/test/functional/generators/assets/cmake_find_package_multi/bye/conanfile.py: -------------------------------------------------------------------------------- 1 | from conans import ConanFile, CMake 2 | 3 | 4 | class ByeConan(ConanFile): 5 | name = "bye" 6 | version = "1.0" 7 | settings = "os", "compiler", "arch", "build_type" 8 | options = {"shared": [True, False]} 9 | default_options = "shared=False" 10 | generators = "cmake_find_package_multi" 11 | exports_sources = "src/*" 12 | requires = "hello/1.0@user/channel" 13 | 14 | def build(self): 15 | cmake = CMake(self) 16 | cmake.configure(source_folder="src") 17 | cmake.build() 18 | 19 | def package(self): 20 | self.copy("*.h", dst="include", keep_path=False) 21 | self.copy("*.lib", dst="lib", keep_path=False) 22 | self.copy("*.dll", dst="bin", keep_path=False) 23 | self.copy("*.so", dst="lib", keep_path=False) 24 | self.copy("*.dylib", dst="lib", keep_path=False) 25 | self.copy("*.a", dst="lib", keep_path=False) 26 | 27 | def package_info(self): 28 | self.cpp_info.libs.append("bye") 29 | -------------------------------------------------------------------------------- /conans/test/unittests/client/conf/config_installer/test_install_folder.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import unittest 4 | import os 5 | 6 | from conans.client.conf.config_installer import tmp_config_install_folder 7 | from conans.test.utils.tools import TestClient 8 | 9 | 10 | class InstallFolderTests(unittest.TestCase): 11 | 12 | def test_unique_install_folder(self): 13 | """ Validate if tmp_config_install_folder is removing old folder before creating a new one 14 | 15 | tmp_config_install_folder must create the same folder, but all items must be exclude when a 16 | new folder is created. 17 | """ 18 | client = TestClient() 19 | 20 | with tmp_config_install_folder(client.cache) as tmp_folder_first: 21 | temp_file = os.path.join(tmp_folder_first, "foobar.txt") 22 | open(temp_file, "w+") 23 | with tmp_config_install_folder(client.cache) as tmp_folder_second: 24 | self.assertEqual(tmp_folder_first, tmp_folder_second) 25 | self.assertFalse(os.path.exists(temp_file)) 26 | -------------------------------------------------------------------------------- /conans/test/functional/graph/loop_detection_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans.test.utils.tools import TestClient 4 | 5 | 6 | class LoopDectectionTest(unittest.TestCase): 7 | 8 | def copy_error_test(self): 9 | client = TestClient() 10 | conanfile = ''' 11 | from conans import ConanFile 12 | 13 | class Package{number}Conan(ConanFile): 14 | name = "Package{number}" 15 | version = "0.1" 16 | requires = "Package{dep}/0.1@lasote/stable" 17 | ''' 18 | for package_number in [1, 2, 3]: 19 | content = conanfile.format(number=package_number, dep=package_number % 3 + 1) 20 | files = {"conanfile.py": content} 21 | 22 | client.save(files, clean_first=True) 23 | client.run("export . lasote/stable") 24 | 25 | client.run("install Package3/0.1@lasote/stable --build", assert_error=True) 26 | self.assertIn("ERROR: Loop detected in context host: 'Package2/0.1@lasote/stable' requires " 27 | "'Package3/0.1@lasote/stable' which is an ancestor too", 28 | client.out) 29 | -------------------------------------------------------------------------------- /conans/util/env_reader.py: -------------------------------------------------------------------------------- 1 | """ 2 | Get variables from environment. 3 | Automatically handle types inferring datatype from default value. 4 | 5 | Usage: 6 | get_env('CONAN_SSL_ENABLED', False) => Will autotransform ENV CONAN_SSL_ENABLED to boolean 7 | 8 | """ 9 | import os 10 | 11 | 12 | def get_env(env_key, default=None, environment=None): 13 | """Get the env variable associated with env_key""" 14 | if environment is None: 15 | environment = os.environ 16 | 17 | env_var = environment.get(env_key, default) 18 | if env_var != default: 19 | if isinstance(default, str): 20 | return env_var 21 | elif isinstance(default, bool): 22 | return env_var == "1" or env_var == "True" 23 | elif isinstance(default, int): 24 | return int(env_var) 25 | elif isinstance(default, float): 26 | return float(env_var) 27 | elif isinstance(default, list): 28 | if env_var.strip(): 29 | return [var.strip() for var in env_var.split(",")] 30 | return [] 31 | return env_var 32 | -------------------------------------------------------------------------------- /conans/test/functional/conan_api/curdir_kept_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.client import tools 5 | from conans.client.conan_api import ConanAPIV1 6 | from conans.test.utils.test_files import temp_folder 7 | 8 | 9 | class CurdirKeptTest(unittest.TestCase): 10 | 11 | def curdir_test(self): 12 | tmp_folder = temp_folder() 13 | conanfile = """from conans import ConanFile 14 | class Pkg(ConanFile): 15 | name = "lib" 16 | version = "1.0" 17 | """ 18 | tools.save(os.path.join(tmp_folder, "conanfile.py"), conanfile) 19 | with tools.chdir(tmp_folder): 20 | # Needed to not write in the real computer cache 21 | with tools.environment_append({"CONAN_USER_HOME": tmp_folder}): 22 | api, _, _ = ConanAPIV1.factory() 23 | api.create(".", name="lib", version="1.0", user="user", channel="channel") 24 | self.assertEqual(tmp_folder, os.getcwd()) 25 | api.create(".", name="lib", version="1.0", user="user", channel="channel2") 26 | self.assertEqual(tmp_folder, os.getcwd()) 27 | -------------------------------------------------------------------------------- /conans/server/crypto/jwt/jwt_manager.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | 3 | import jwt 4 | 5 | 6 | class JWTManager(object): 7 | """ 8 | Handles the JWT token generation and encryption. 9 | """ 10 | 11 | def __init__(self, secret, expire_time): 12 | """expire_time is a timedelta 13 | secret is a string with the secret encoding key""" 14 | self.secret = secret 15 | self.expire_time = expire_time 16 | 17 | def get_token_for(self, profile_fields=None): 18 | """Generates a token with the provided fields. 19 | if exp is True, expiration time will be used""" 20 | profile_fields = profile_fields or {} 21 | 22 | if self.expire_time: 23 | profile_fields["exp"] = datetime.utcnow() + self.expire_time 24 | 25 | return jwt.encode(profile_fields, self.secret) 26 | 27 | def get_profile(self, token): 28 | """Gets the user from credentials object. None if no credentials. 29 | Can raise jwt.ExpiredSignature and jwt.DecodeError""" 30 | profile = jwt.decode(token, self.secret) 31 | return profile 32 | -------------------------------------------------------------------------------- /conans/test/unittests/server/authenticator_plugin_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.server.plugin_loader import load_authentication_plugin 5 | from conans.test.utils.test_files import temp_folder 6 | from conans.util.files import save 7 | 8 | 9 | class AuthenticatorPluginTest(unittest.TestCase): 10 | 11 | def instance_authenticator_test(self): 12 | folder = temp_folder() 13 | plugin_path = os.path.join(folder, "plugins", "authenticator", "my_auth.py") 14 | my_plugin = ''' 15 | # import to test that they work 16 | import os 17 | 18 | def get_class(): 19 | return MyAuthenticator() 20 | 21 | 22 | class MyAuthenticator(object): 23 | def valid_user(self, username, plain_password): 24 | os.path.exists("somepath") # dummy call, to test that os is not removed by GC 25 | return username == "foo" and plain_password == "bar" 26 | ''' 27 | save(plugin_path, my_plugin) 28 | 29 | plugin = load_authentication_plugin(folder, "my_auth") 30 | self.assertTrue(plugin.valid_user("foo", "bar")) 31 | self.assertFalse(plugin.valid_user("foo2", "bar2")) 32 | -------------------------------------------------------------------------------- /conans/test/unittests/client/file_copier/test_report_copied_files.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import unittest 4 | 5 | from conans.client.file_copier import report_copied_files 6 | from conans.test.utils.tools import TestBufferConanOutput 7 | 8 | 9 | class ReportCopiedFilesTestCase(unittest.TestCase): 10 | 11 | def test_output_string(self): 12 | output = TestBufferConanOutput() 13 | 14 | files = ['/abs/path/to/file.pdf', 15 | '../rel/path/to/file2.pdf', 16 | '../rel/path/to/file3.pdf', 17 | '../rel/path/to/file4.pdf', 18 | '../rel/path/to/file5.pdf', 19 | '../rel/path/to/file6.pdf', 20 | '../rel/path/to/file7.pdf', 21 | '/without/ext/no_ext1', 22 | 'no_ext2', 23 | 'a/other.txt'] 24 | 25 | report_copied_files(files, output) 26 | lines = sorted(str(output).splitlines()) 27 | self.assertEqual("Copied 7 '.pdf' files", lines[2]) 28 | self.assertEqual("Copied 2 files: no_ext1, no_ext2", lines[1]) 29 | self.assertEqual("Copied 1 '.txt' file: other.txt", lines[0]) 30 | -------------------------------------------------------------------------------- /conans/test/unittests/client/generators/virtualenv_python_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from conans import ConanFile, Settings 4 | from conans.client.generators.virtualenv_python import VirtualEnvPythonGenerator 5 | from conans.model.env_info import DepsEnvInfo 6 | from conans.model.env_info import EnvValues 7 | from conans.test.utils.tools import TestBufferConanOutput 8 | 9 | 10 | class VirtualEnvPythonGeneratorTest(unittest.TestCase): 11 | 12 | def pythonpath_test(self): 13 | """ 14 | Check PYTHONPATH env variable 15 | """ 16 | conanfile = ConanFile(TestBufferConanOutput(), None) 17 | conanfile.initialize(Settings({}), EnvValues.loads("PYTHONPATH=[1,2,three]")) 18 | conanfile.deps_env_info = DepsEnvInfo.loads( 19 | '[ENV_A]\nPYTHONPATH=["DepAPath"]\n[ENV_B]\nPYTHONPATH=["DepBPath"]' 20 | ) 21 | gen = VirtualEnvPythonGenerator(conanfile) 22 | gen.output_path = "not-used" 23 | content = gen.content 24 | 25 | self.assertIn('PYTHONPATH="1":"2":"three":"DepAPath":"DepBPath"${PYTHONPATH+:$PYTHONPATH}', 26 | content["environment_run_python.sh.env"]) 27 | 28 | -------------------------------------------------------------------------------- /conans/test/functional/configuration/invalid_settings_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import textwrap 3 | import unittest 4 | 5 | from conans.test.utils.tools import TestClient 6 | 7 | 8 | class SettingsLoadTestCase(unittest.TestCase): 9 | def test_invalid_settings(self): 10 | client = TestClient() 11 | client.save({os.path.join(client.cache_folder, 'settings.yml'): """your buggy file"""}) 12 | client.run("new -b hello/1.0") 13 | client.run("install .", assert_error=True) 14 | self.assertIn("ERROR: Invalid settings.yml format", client.out) 15 | 16 | def test_invalid_yaml(self): 17 | client = TestClient() 18 | client.save({os.path.join(client.cache_folder, 'settings.yml'): 19 | textwrap.dedent(""" 20 | Almost: 21 | - a 22 | - valid 23 | yaml 24 | """)}) 25 | client.run("new -b hello/1.0") 26 | client.run("install .", assert_error=True) 27 | self.assertIn("ERROR: Invalid settings.yml format: while parsing a block mapping", 28 | client.out) 29 | -------------------------------------------------------------------------------- /conans/model/conan_generator.py: -------------------------------------------------------------------------------- 1 | from abc import ABCMeta, abstractproperty 2 | 3 | import six 4 | 5 | 6 | @six.add_metaclass(ABCMeta) 7 | class Generator(object): 8 | 9 | def __init__(self, conanfile): 10 | self.conanfile = conanfile 11 | self.normalize = True 12 | self._deps_build_info = conanfile.deps_cpp_info 13 | self._deps_env_info = conanfile.deps_env_info 14 | self._env_info = conanfile.env_info 15 | self._deps_user_info = conanfile.deps_user_info 16 | 17 | @property 18 | def deps_build_info(self): 19 | return self._deps_build_info 20 | 21 | @property 22 | def deps_env_info(self): 23 | return self._deps_env_info 24 | 25 | @property 26 | def deps_user_info(self): 27 | return self._deps_user_info 28 | 29 | @property 30 | def env_info(self): 31 | return self._env_info 32 | 33 | @property 34 | def settings(self): 35 | return self.conanfile.settings 36 | 37 | @abstractproperty 38 | def content(self): 39 | raise NotImplementedError() 40 | 41 | @abstractproperty 42 | def filename(self): 43 | raise NotImplementedError() 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 JFrog LTD 4 | 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | 29 | -------------------------------------------------------------------------------- /conans/client/run_environment.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class RunEnvironment(object): 4 | """ 5 | - PATH: pointing to the bin/ directories of the requires 6 | - LD_LIBRARY_PATH: requires lib_paths for Linux 7 | - DYLD_LIBRARY_PATH: requires lib_paths for OSx 8 | - DYLD_FRAMEWORK_PATH: requires framework_paths for OSX 9 | """ 10 | def __init__(self, conanfile): 11 | """ 12 | :param conanfile: ConanFile instance 13 | """ 14 | self.conanfile = conanfile 15 | 16 | @property 17 | def vars(self): 18 | lib_paths = [] 19 | bin_paths = [] 20 | framework_paths = [] 21 | for dep in self.conanfile.deps_cpp_info.deps: 22 | lib_paths.extend(self.conanfile.deps_cpp_info[dep].lib_paths) 23 | bin_paths.extend(self.conanfile.deps_cpp_info[dep].bin_paths) 24 | framework_paths.extend(self.conanfile.deps_cpp_info[dep].framework_paths) 25 | 26 | ret = {"DYLD_LIBRARY_PATH": lib_paths, 27 | "LD_LIBRARY_PATH": lib_paths, 28 | "PATH": bin_paths} 29 | if framework_paths: 30 | ret["DYLD_FRAMEWORK_PATH"] = framework_paths 31 | 32 | return ret 33 | -------------------------------------------------------------------------------- /conans/test/functional/build_helpers/meson_test.py: -------------------------------------------------------------------------------- 1 | import platform 2 | import textwrap 3 | import unittest 4 | 5 | from conans.test.utils.tools import TestClient 6 | 7 | 8 | class MesonTest(unittest.TestCase): 9 | 10 | @unittest.skipIf(platform.system() != "Windows", "Needs windows for vcvars") 11 | def test_vcvars_priority(self): 12 | # https://github.com/conan-io/conan/issues/5999 13 | client = TestClient() 14 | conanfile_vcvars = textwrap.dedent(""" 15 | import os 16 | from conans import ConanFile, Meson 17 | 18 | class HelloConan(ConanFile): 19 | settings = "os", "compiler", "arch", "build_type" 20 | def build(self): 21 | cmake = Meson(self, append_vcvars=True) 22 | cmake.configure() 23 | 24 | # CAPTURING THE RUN METHOD 25 | def run(self, cmd): 26 | self.output.info("PATH ENV VAR: %s" % os.getenv("PATH")) 27 | """) 28 | 29 | client.save({"conanfile.py": conanfile_vcvars}) 30 | client.run('create . pkg/1.0@ -e PATH="MyCustomPath"') 31 | self.assertIn("pkg/1.0: PATH ENV VAR: MyCustomPath;", client.out) -------------------------------------------------------------------------------- /conans/client/generators/virtualbuildenv.py: -------------------------------------------------------------------------------- 1 | from conans.client.build.autotools_environment import AutoToolsBuildEnvironment 2 | from conans.client.build.visual_environment import VisualStudioBuildEnvironment 3 | from conans.client.generators.virtualenv import VirtualEnvGenerator 4 | from conans.client.tools.win import vcvars_dict 5 | 6 | 7 | class VirtualBuildEnvGenerator(VirtualEnvGenerator): 8 | 9 | suffix = "_build" 10 | venv_name = "conanbuildenv" 11 | 12 | def __init__(self, conanfile): 13 | super(VirtualBuildEnvGenerator, self).__init__(conanfile) 14 | compiler = conanfile.settings.get_safe("compiler") 15 | if compiler == "Visual Studio": 16 | self.env = VisualStudioBuildEnvironment(conanfile).vars_dict 17 | settings_vars = vcvars_dict(conanfile.settings, output=conanfile.output) 18 | # self.env has higher priority, so only extend (append) to it. 19 | for name, value in self.env.items(): 20 | if isinstance(value, list): 21 | value.extend(settings_vars.pop(name, [])) 22 | 23 | self.env.update(settings_vars) 24 | else: 25 | self.env = AutoToolsBuildEnvironment(conanfile).vars_dict 26 | -------------------------------------------------------------------------------- /conans/test/functional/generators/multi_generators_test.py: -------------------------------------------------------------------------------- 1 | import textwrap 2 | import unittest 3 | 4 | from parameterized import parameterized 5 | 6 | from conans.test.utils.tools import TestClient 7 | 8 | 9 | class MultiGeneratorsTestCase(unittest.TestCase): 10 | 11 | @parameterized.expand([("cmake_find_package_multi",), 12 | ("visual_studio_multi", ), 13 | ("cmake_multi", )]) 14 | def test_no_build_type_test(self, generator): 15 | client = TestClient() 16 | 17 | conanfile = textwrap.dedent(""" 18 | from conans import ConanFile, CMake 19 | 20 | class Conan(ConanFile): 21 | settings = "os", "arch", "compiler" 22 | generators = "{generator}" 23 | 24 | def build(self): 25 | cmake = CMake(self) 26 | cmake.configure() 27 | """.format(generator=generator)) 28 | 29 | client.save({"conanfile.py": conanfile}) 30 | client.run('install . -s compiler="Visual Studio"' 31 | ' -s compiler.version=15 -s compiler.toolset=v100', assert_error=True) 32 | self.assertIn("ERROR: 'settings.build_type' doesn't exist", client.out) 33 | -------------------------------------------------------------------------------- /conans/__init__.py: -------------------------------------------------------------------------------- 1 | # Allow conans to import ConanFile from here 2 | # to allow refactors 3 | from conans.client.build.autotools_environment import AutoToolsBuildEnvironment 4 | from conans.client.build.cmake import CMake 5 | from conans.client.build.meson import Meson 6 | from conans.client.build.msbuild import MSBuild 7 | from conans.client.build.visual_environment import VisualStudioBuildEnvironment 8 | from conans.client.run_environment import RunEnvironment 9 | from conans.model.conan_file import ConanFile 10 | from conans.model.options import Options 11 | from conans.model.settings import Settings 12 | from conans.util.files import load 13 | 14 | # complex_search: With ORs and not filtering by not restricted settings 15 | COMPLEX_SEARCH_CAPABILITY = "complex_search" 16 | CHECKSUM_DEPLOY = "checksum_deploy" # Only when v2 17 | REVISIONS = "revisions" # Only when enabled in config, not by default look at server_launcher.py 18 | ONLY_V2 = "only_v2" # Remotes and virtuals from Artifactory returns this capability 19 | MATRIX_PARAMS = "matrix_params" 20 | OAUTH_TOKEN = "oauth_token" 21 | SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, REVISIONS] # Server is always with revisions 22 | DEFAULT_REVISION_V1 = "0" 23 | 24 | __version__ = '1.26.0-dev' 25 | 26 | -------------------------------------------------------------------------------- /conans/test/functional/scm/test_url_auto.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import textwrap 4 | import unittest 5 | 6 | from conans.model.ref import ConanFileReference 7 | from conans.test.utils.tools import TestClient, create_local_git_repo 8 | 9 | 10 | class RemoveCredentials(unittest.TestCase): 11 | 12 | conanfile = textwrap.dedent("""\ 13 | from conans import ConanFile 14 | 15 | class Lib(ConanFile): 16 | scm = {"type": "git", "url": "auto"} 17 | 18 | """) 19 | 20 | def setUp(self): 21 | self.ref = ConanFileReference.loads("lib/1.0@lasote/testing") 22 | self.path, _ = create_local_git_repo({"conanfile.py": self.conanfile}) 23 | self.client = TestClient() 24 | self.client.current_folder = self.path 25 | self.client.run_command("git remote add origin https://url.to.be.sustituted") 26 | 27 | def test_https(self): 28 | expected_url = 'https://myrepo.com.git' 29 | origin_url = 'https://username:password@myrepo.com.git' 30 | self.client.run_command("git remote set-url origin {}".format(origin_url)) 31 | self.client.run("export . {}".format(self.ref)) 32 | self.assertIn("Repo origin deduced by 'auto': {}".format(expected_url), self.client.out) 33 | -------------------------------------------------------------------------------- /conans/server/rest/api_v2.py: -------------------------------------------------------------------------------- 1 | from bottle import Bottle 2 | 3 | from conans.server.rest.api_v1 import ApiV1 4 | from conans.server.rest.controller.common.ping import PingController 5 | from conans.server.rest.controller.common.users import UsersController 6 | from conans.server.rest.controller.v2.conan import ConanControllerV2 7 | from conans.server.rest.controller.v2.delete import DeleteControllerV2 8 | from conans.server.rest.controller.v2.revisions import RevisionsController 9 | from conans.server.rest.controller.v2.search import SearchControllerV2 10 | 11 | 12 | class ApiV2(ApiV1): 13 | 14 | def __init__(self, credentials_manager, server_capabilities): 15 | 16 | self.credentials_manager = credentials_manager 17 | self.server_capabilities = server_capabilities 18 | Bottle.__init__(self) 19 | 20 | def setup(self): 21 | self.install_plugins() 22 | 23 | # Capabilities in a ping 24 | PingController().attach_to(self) 25 | 26 | SearchControllerV2().attach_to(self) 27 | DeleteControllerV2().attach_to(self) 28 | ConanControllerV2().attach_to(self) 29 | RevisionsController().attach_to(self) 30 | 31 | # Install users controller 32 | UsersController().attach_to(self) 33 | -------------------------------------------------------------------------------- /conans/test/functional/configuration/client_certs_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from conans.client import tools 5 | from conans.test.utils.tools import TestClient 6 | 7 | 8 | class ClientCertsTest(unittest.TestCase): 9 | 10 | def pic_client_certs_test(self): 11 | 12 | class MyRequester(object): 13 | 14 | def __init__(*args, **kwargs): 15 | pass 16 | 17 | def get(self, _, **kwargs): 18 | return kwargs.get("cert", None) 19 | 20 | client = TestClient(requester_class=MyRequester) 21 | self.assertIsNone(client.requester.get("url")) 22 | 23 | config = client.cache.config 24 | tools.save(config.client_cert_path, "Fake cert") 25 | 26 | self.assertEqual(client.requester.get("url"), client.cache.config.client_cert_path) 27 | 28 | tools.save(config.client_cert_path, "Fake cert") 29 | tools.save(config.client_cert_key_path, "Fake key") 30 | self.assertEqual(client.requester.get("url"), (config.client_cert_path, 31 | config.client_cert_key_path)) 32 | 33 | # assert that the cacert file is created 34 | self.assertTrue(os.path.exists(config.cacert_path)) 35 | -------------------------------------------------------------------------------- /conans/test/unittests/util/files/test_remove.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import os 4 | import stat 5 | import unittest 6 | 7 | import six 8 | 9 | from conans.test.utils.test_files import temp_folder 10 | from conans.util.files import remove, save 11 | 12 | 13 | class RemoveTest(unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.file = os.path.join(temp_folder(), 'file.txt') 17 | save(self.file, "some content") 18 | 19 | def test_remove(self): 20 | remove(self.file) 21 | self.assertFalse(os.path.exists(self.file)) 22 | self.assertTrue(os.path.exists(os.path.dirname(self.file))) 23 | 24 | def test_remove_readonly(self): 25 | os.chmod(self.file, stat.S_IREAD|stat.S_IRGRP|stat.S_IROTH) 26 | with six.assertRaisesRegex(self, (IOError, OSError), "Permission denied"): 27 | save(self.file, "change the content") 28 | remove(self.file) 29 | self.assertFalse(os.path.exists(self.file)) 30 | self.assertTrue(os.path.exists(os.path.dirname(self.file))) 31 | 32 | def test_remove_folder(self): 33 | dirname = os.path.dirname(self.file) 34 | self.assertRaises(AssertionError, remove, dirname) 35 | self.assertTrue(os.path.exists(dirname)) 36 | 37 | -------------------------------------------------------------------------------- /conans/test/unittests/client/rest/response_test.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | import unittest 4 | from collections import namedtuple 5 | from conans.client import rest 6 | 7 | 8 | class RestStringTest(unittest.TestCase): 9 | 10 | def _get_html_response(self): 11 | headers = {"content-type": "text/html;charset=utf-8",} 12 | return namedtuple("Response", "status_code headers reason content")( 13 | 404, 14 | headers, 15 | "Not Found", 16 | b'\n\n