Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XcodeDeps: use SYSTEM_HEADER_SEARCH_PATHS as include search paths to suppress warnings #14157

Merged

Conversation

wAuner
Copy link
Contributor

@wAuner wAuner commented Jun 23, 2023

fixes #14147

Changelog: Fix: Change the xcconfig variable from HEADER_SEARCH_PATHS to SYSTEM_HEADER_SEARCH_PATHS changes the command line from -i to -isystem and avoids warnings that arise from including package headers.
Docs: conan-io/docs#3372

Warnings that arise from including package headers are now suppressed by default for the XcodeDeps generator. This is in line to how other generators, such as the cmake generator behave (see #8543).
Changing the xcconfig variable from HEADER_SEARCH_PATHS to SYSTEM_HEADER_SEARCH_PATHS changes the command line from -i to -isystem.

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.

@CLAassistant
Copy link

CLAassistant commented Jun 23, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for contributing this.
There is a test failing, test_generator_files() in https://ci.conan.io/blue/organizations/jenkins/ConanTestSuite/detail/PR-14157/1/pipeline/41, because it was testing the generated files output, it should be easy to change too.

@memsharded memsharded modified the milestones: 2.0.8, 1.61 Jun 23, 2023
@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

I'm having trouble to get the tests running. I wanted to try to write some additional tests for the other PR I'm preparing.
I've tried to follow the instructions by installing the requirements via

$ python3.11 -m pip install -r conans/requirements_server.txt
$ python3.11 -m pip install -r conans/requirements_dev.txt

and I've exported the env variable

$ export PYTHONPATH=$PYTHONPATH:$(pwd)

I've also created a conftest_user.py with the following contents:

tools_locations = {
    'svn': {"disabled": True},
    'cmake': {"disabled": True},
    'ninja': {
        "disabled": True
    },
    'meson': {"disabled": True},
    'bazel':  {
        "disable": True,
    },
    'autotools': {"disabled": True},
    'premake': {"disabled": True},
    'android_ndk': {"disabled": True},
}

But when try to run the command I get:

python3.11 -m pytest .
============================================================ test session starts ============================================================
platform darwin -- Python 3.11.4, pytest-6.2.5, py-1.11.0, pluggy-1.2.0
rootdir: /Users/picard/Developer/conan-io, configfile: pytest.ini
plugins: xdist-3.3.1
collected 0 items / 1 error

================================================================== ERRORS ===================================================================
_______________________________________________________ ERROR collecting test session _______________________________________________________
/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1126: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1126: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:940: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
conans/__init__.py:1: in <module>
    from conans.client.build.autotools_environment import AutoToolsBuildEnvironment
conans/client/build/autotools_environment.py:6: in <module>
    from conans.client.build.compiler_flags import (architecture_flag, build_type_define,
conans/client/build/compiler_flags.py:13: in <module>
    from conans.client.tools.apple import to_apple_arch
conans/client/tools/__init__.py:4: in <module>
    from .apple import *
conans/client/tools/apple.py:5: in <module>
    from conans.util.runners import check_output_runner
conans/util/runners.py:9: in <module>
    from conans.client.tools.files import load
conans/client/tools/files.py:12: in <module>
    from patch_ng import fromfile, fromstring
E   ModuleNotFoundError: No module named 'patch_ng'
========================================================== short test summary info ==========================================================
ERROR  - ModuleNotFoundError: No module named 'patch_ng'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================= 1 error in 0.10s ==============================================================

same if try to run with sudo.

I get a similar error if I try to run only the apple tools tests:

python3.11 -m pytest conans/test/unittests/tools/apple/test_apple_tools.py -s
ImportError while loading conftest '/Users/picard/Developer/conan-io/conans/test/conftest.py'.
conans/__init__.py:1: in <module>
    from conans.client.build.autotools_environment import AutoToolsBuildEnvironment
conans/client/build/autotools_environment.py:6: in <module>
    from conans.client.build.compiler_flags import (architecture_flag, build_type_define,
conans/client/build/compiler_flags.py:13: in <module>
    from conans.client.tools.apple import to_apple_arch
conans/client/tools/__init__.py:4: in <module>
    from .apple import *
conans/client/tools/apple.py:5: in <module>
    from conans.util.runners import check_output_runner
conans/util/runners.py:9: in <module>
    from conans.client.tools.files import load
conans/client/tools/files.py:12: in <module>
    from patch_ng import fromfile, fromstring
E   ModuleNotFoundError: No module named 'patch_ng'

Any help would be appreciated.

@memsharded
Copy link
Member

That is weird, for some reason it seems patch_ng (our own lib) pip package has not been installed? What does a pip list/freeze shows in your environment? Maybe try to pip install again and check the logs for patch_ng?

@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

ok apparently there are many packages missing from the provided requirements.
So far I've needed to install:

  • patch_ng
  • colorama
  • tqdm
  • fasteners
  • pyyaml
  • requests

Then I've tried semver but now I get an error from semver:

pip install semver && python -m pytest .
Collecting semver
  Downloading semver-3.0.1-py3-none-any.whl (17 kB)
Installing collected packages: semver
Successfully installed semver-3.0.1
============================================================ test session starts ============================================================
platform darwin -- Python 3.11.4, pytest-6.2.5, py-1.11.0, pluggy-1.2.0
rootdir: /Users/picard/Developer/conan-io, configfile: pytest.ini
plugins: xdist-3.3.1
collected 0 items / 1 error

================================================================== ERRORS ===================================================================
_______________________________________________________ ERROR collecting test session _______________________________________________________
/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1126: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1126: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:940: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
conans/__init__.py:4: in <module>
    from conans.client.build.msbuild import MSBuild
conans/client/build/msbuild.py:15: in <module>
    from conans.tools import vcvars_command as tools_vcvars_command
conans/tools.py:31: in <module>
    from conans.client.tools.version import Version
conans/client/tools/version.py:5: in <module>
    from semver import SemVer
E   ImportError: cannot import name 'SemVer' from 'semver' (/Users/picard/Developer/conan-io/venv/lib/python3.11/site-packages/semver/__init__.py)
========================================================== short test summary info ==========================================================
ERROR  - ImportError: cannot import name 'SemVer' from 'semver' (/Users/picard/Developer/conan-io/venv/lib/python3.11/site-packages/semver...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================= 1 error in 0.12s ==============================================================

I've tried this with a fresh venv.

@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

It's been a while since I've done anything major in Python, so here are my exact steps with a fresh venv:

$ python3.11 -m venv venv
$ source venv/bin/activate
$ python -m pip install -r conans/requirements_server.txt
python -m pip install -r conans/requirements_dev.txt
Collecting bottle<0.13,>=0.12.8
  Using cached bottle-0.12.25-py3-none-any.whl (90 kB)
Collecting pluginbase>=0.5
  Using cached pluginbase-1.0.1-py3-none-any.whl
Collecting PyJWT<3.0.0,>=2.4.0
  Using cached PyJWT-2.7.0-py3-none-any.whl (22 kB)
Installing collected packages: pluginbase, bottle, PyJWT
Successfully installed PyJWT-2.7.0 bottle-0.12.25 pluginbase-1.0.1

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Ignoring pytest: markers 'python_version < "3.0"' don't match your environment
Collecting pytest<7.0.0,>=6.1.1
  Using cached pytest-6.2.5-py3-none-any.whl (280 kB)
Collecting pytest-xdist
  Using cached pytest_xdist-3.3.1-py3-none-any.whl (41 kB)
Collecting parameterized>=0.6.3
  Using cached parameterized-0.9.0-py2.py3-none-any.whl (20 kB)
Collecting mock<1.4.0,>=1.3.0
  Using cached mock-1.3.0-py2.py3-none-any.whl (56 kB)
Collecting WebTest<2.1.0,>=2.0.18
  Using cached WebTest-2.0.35-py2.py3-none-any.whl (32 kB)
Requirement already satisfied: bottle in ./venv/lib/python3.11/site-packages (from -r conans/requirements_dev.txt (line 7)) (0.12.25)
Collecting attrs>=19.2.0
  Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Collecting iniconfig
  Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Collecting packaging
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting pluggy<2.0,>=0.12
  Using cached pluggy-1.2.0-py3-none-any.whl (17 kB)
Collecting py>=1.8.2
  Using cached py-1.11.0-py2.py3-none-any.whl (98 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting execnet>=1.1
  Using cached execnet-1.9.0-py2.py3-none-any.whl (39 kB)
Collecting pbr>=0.11
  Using cached pbr-5.11.1-py2.py3-none-any.whl (112 kB)
Collecting six>=1.7
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting WebOb>=1.2
  Using cached WebOb-1.8.7-py2.py3-none-any.whl (114 kB)
Collecting waitress>=0.8.5
  Using cached waitress-2.1.2-py3-none-any.whl (57 kB)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
Collecting soupsieve>1.2
  Using cached soupsieve-2.4.1-py3-none-any.whl (36 kB)
Installing collected packages: WebOb, waitress, toml, soupsieve, six, py, pluggy, pbr, parameterized, packaging, iniconfig, execnet, attrs, pytest, mock, beautifulsoup4, WebTest, pytest-xdist
Successfully installed WebOb-1.8.7 WebTest-2.0.35 attrs-23.1.0 beautifulsoup4-4.12.2 execnet-1.9.0 iniconfig-2.0.0 mock-1.3.0 packaging-23.1 parameterized-0.9.0 pbr-5.11.1 pluggy-1.2.0 py-1.11.0 pytest-6.2.5 pytest-xdist-3.3.1 six-1.16.0 soupsieve-2.4.1 toml-0.10.2 waitress-2.1.2

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip

$ pip freeze
attrs==23.1.0
beautifulsoup4==4.12.2
bottle==0.12.25
execnet==1.9.0
iniconfig==2.0.0
mock==1.3.0
packaging==23.1
parameterized==0.9.0
pbr==5.11.1
pluggy==1.2.0
pluginbase==1.0.1
py==1.11.0
PyJWT==2.7.0
pytest==6.2.5
pytest-xdist==3.3.1
six==1.16.0
soupsieve==2.4.1
toml==0.10.2
waitress==2.1.2
WebOb==1.8.7
WebTest==2.0.35

@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

ah my bad, I forget the normal requirements.txt

@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

I just noticed that develop is still version 1. Was it correct to open this PR against develop instead of develop2?

@memsharded
Copy link
Member

memsharded commented Jun 23, 2023

Yes, as it was not explicit in your issue report, and you did the PR to develop, I assumed that you were using 1.X.

If that is not the case, don't worry much, this can be merged, and I will merge it too to release/2.0, so it is next 2.0.8 release too. (develop2 is for next minor 2.1.0, and release/2.0 is for next patch 2.0.X)

@memsharded memsharded merged commit ccdd94f into conan-io:develop Jun 23, 2023
@memsharded
Copy link
Member

Merged, thanks very much for your contribution! It will be in 1.61 and 2.0.8

@wAuner
Copy link
Contributor Author

wAuner commented Jun 23, 2023

Alright thanks, I just followed the instructions which didn't mention develop2. I'm using version 2.

@wAuner
Copy link
Contributor Author

wAuner commented Jul 13, 2023

@memsharded Hey James, is this PR included in the 2.0.8 release? I couldn't find it in the release notes.

@memsharded
Copy link
Member

Yes, @wAuner it should be there, because 1.X is merged to 2.0.X, just the release notes are not automatic and it was skipped. But it definitely should be in 2.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants