wingtk / gvsbuild

GTK stack for Windows
GNU General Public License v2.0
432 stars 163 forks source link

AttributeError: 'list' object has no attribute 'split' #957

Closed doadin closed 1 year ago

doadin commented 1 year ago

Running

gvsbuild build --platform=x64 --vs-ver=17 --enable-gi --py-wheel --skip gtksourceview4,emeus,clutter gtk3-full pycairo pygobject lz4 enchant

The same command I used like a year ago to build successfully I am now getting error:

`

+--------------------- Traceback (most recent call last) ---------------------+ C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\gvsbuild\bu ild.py:419 in build
416 pv = f"'{v}'" if type(v) is str else repr(v)
417 log.message_indent(f"'{co}': {pv}, ")
418 builder = Builder(opts)
> 419 builder.preprocess()
420
421 to_build = __get_projects_to_build(opts)
422 if not to_build:
+-------------------------------- locals ---------------------------------+
archives_download_dir = WindowsPath('C:/gtk-build/src')
build_dir = WindowsPath('C:/gtk-build')
builder = <gvsbuild.utils.builder.Builder object
at 0x00000252357FDC00>
capture_out = False
cargo_opts = None
check_hash = False
clean = False
clean_built = False
configuration = <Configuration.debug_optimized:
'debug-optimized'>
debug = False
deps = True
enable_gi = True
export_dir = None
fast_build = False
ffmpeg_enable_gpl = False
from_scratch = False
git_expand_dir = None
keep_going = False
keep_tools = False
log_single = False
log_size = 0
make_zip = False
msbuild_opts = None
msys_dir = None
net_target_framework = None
net_target_framework_version = None
ninja_opts = None
opts = <gvsbuild.utils.base_project.Options
object at 0x0000025235AC9FF0>
p = 'enchant'
patches_root_dir = WindowsPath('C:/hostedtoolcache/windows�
platform = <Platform.x64: 'x64'>
print_out = False
projects = [
'gtk3-full',
'pycairo',
'pygobject',
'lz4',
'enchant'
]
prop_file = WindowsPath('C:/hostedtoolcache/windows�
py_wheel = True
skip = ['gtksourceview4,emeus,clutter']
tools_root_dir = None
use_env = False
verbose = False
vs_install_path = None
vs_ver = <VsVer.vs2022: '17'>
win_sdk_ver = None
zip_continue = False
+-------------------------------------------------------------------------+
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\gvsbuild\ut
ils\builder.py:470 in preprocess
467 proj.clean = True
468
469 for proj in Project.list_projects():
> 470 self.__compute_deps(proj)
471 log.debug(f"{proj.name} => {[d.name for d in proj.all_de
472
473 def __compute_deps(self, proj):
+-------------------------------- locals ---------------------------------+
archive = 'go1.20.4.windows-amd64.zip'
proj = 'dev-shell'
self = <gvsbuild.utils.builder.Builder object at 0x00000252357FDC00>
url = 'https://go.dev/dl/go1.20.4.windows-amd64.zip'
+-------------------------------------------------------------------------+
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\gvsbuild\ut
ils\builder.py:482 in __compute_deps
479 for p in dep.all_dependencies:
480 deps.add(p)
481 deps.add(dep)
> 482 proj.finalize_dep(self, deps)
483 proj.all_dependencies = deps
484
485 def _drop_proj(self, drop_prj):
+------------------------------- locals -------------------------------+
dep = 'tools'
deps = {
'cargo',
'cmake',
'go',
'meson',
'msys2',
'nasm',
'ninja',
'perl',
'tools'
}
p = 'perl'
proj = 'dev-shell'
self = <gvsbuild.utils.builder.Builder object at 0x00000252357FDC00>
+----------------------------------------------------------------------+
C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\gvsbuild\pr
ojects\dev_shell.py:46 in finalize_dep
43
44 def finalize_dep(self, builder, deps):
45 if builder.opts.skip:
> 46 skip = builder.opts.skip.split(",")
47 for s in skip:
48 p = Project.get_project(s)
49 if p in deps:
+-------------------------------- locals ---------------------------------+
builder = <gvsbuild.utils.builder.Builder object at 0x00000252357FDC00>
deps = {
'cargo',
'cmake',
'go',
'meson',
'msys2',
'nasm',
'ninja',
'perl',
'tools'
}
self = 'dev-shell'
+-------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+ AttributeError: 'list' object has no attribute 'split'

`

danyeaw commented 1 year ago

Hi @doadin, try using spaces between the project names with no commas

doadin commented 1 year ago

@danyeaw Did not help.

The build and workflow file:

https://github.com/doadin/gvsbuild-release/actions/runs/5140393185/jobs/9251807193 . https://github.com/doadin/gvsbuild-release/actions/runs/5140393185/workflow .

danyeaw commented 1 year ago

Got it, thanks! I can reproduce this, I missed that you were using the --skip option last evening.

I opened a PR to fix this, I think you'll need to reorganize the options you put in, like:

> gvsbuild build --enable-gi --py-wheel gtk3-full pycairo pygobject lz4 enchant --sk
ip gtksourceview4 emeus clutter gtk3-full pycairo pygobject lz4 enchant

or

> gvsbuild build --skip gtksourceview4 emeus clutter --enable-gi --py-wheel gtk3-full pycairo pygobject lz4 enchant
doadin commented 1 year ago

Thanks for this, it now builds further but I am running into another issue. https://github.com/doadin/gvsbuild-release/actions/runs/5149056649/jobs/9271570707

doadin commented 1 year ago

I should probabbly make a new Issue for this but I see, https://github.com/mesonbuild/meson/blob/master/mesonbuild/compilers/c.py#L487 that in the log and https://github.com/wingtk/gvsbuild/commit/53753e7df5ab23087b7f75286f4ebfdaba9e3362

Maybe theres was something missing in changing to meson?

danyeaw commented 1 year ago

Hi @doadin, you need to move the Git/bin folder out of the way that is on the GitHub Actions runner:

- name: GTK binaries move git binary
  run: |
    move "C:\Program Files\Git\usr\bin" "C:\Program Files\Git\usr\notbin"
    move "C:\Program Files\Git\bin" "C:\Program Files\Git\notbin"
doadin commented 1 year ago

@danyeaw ok, I had:

`

  - name: Move git binary
    # Temporarily move preinstalled git to prevent errors related to cygwin.
    run: Rename-Item "C:\Program Files\Git\usr\bin" notbin

`

so was missing the other part I guess. Thanks! testing now.

doadin commented 1 year ago

@danyeaw Made it a lot further but still error: https://github.com/doadin/gvsbuild-release/actions/runs/5150698778/jobs/9275134361

danyeaw commented 1 year ago

@doadin It looks like Cogl is failing. I saw you were skipping Clutter, do you need Cogl?

doadin commented 1 year ago

@danyeaw Im just building gtk for use with deluge, I dont think it uses either. I was just trying to update my build, is this a build issue for gvsbuild or cogl?

danyeaw commented 1 year ago

It is a cogl issue. Our CI, builds the following things:

gvsbuild build --ninja-opts -j2 gtk3 gtksourceview4 graphene glib-networking
gvsbuild build --ninja-opts -j2 --enable-gi cairo gtk4 libadwaita gtksourceview5 gobject-introspection adwaita-icon-theme hicolor-icon-theme
doadin commented 1 year ago

@danyeaw ah, and the link to cogl goes to a gitlab that is "Archived" and hasnt been updated in 2 years so I guess thats never getting fixed.

doadin commented 1 year ago

@danyeaw I am probabbly just missing something but I tried to add to skip and it did NOT skip.

doadin commented 1 year ago

https://github.com/doadin/gvsbuild-release/actions/runs/5155632019/jobs/9285556319

danyeaw commented 1 year ago

It looks like it is not possible to pass a list of optional values in with Typer which is the library we are using: https://github.com/tiangolo/typer/issues/554

It is possible to call it each time though it looks like, and I verified that it dropped both:

> gvsbuild build --skip cogl --skip gtksourceview4 gtk3-full

Or you could also just explicitly call out the libraries you want to build and avoid using the gtk3-full group. I'll update the help menu and README to make this clearer.

doadin commented 1 year ago

@danyeaw ok I will test this. Thank you, helping me along here. All I know is the build process was successful Jun 13, 2022. I tried to re-run same github action this week and it failed. SO what happened between then and now and why I am just trying. :)

doadin commented 1 year ago

@danyeaw yea the multiple skips seems to work but got another error for librsvg. Probabbly should just choose what part I need instead of full, would probabbly be easier.

danyeaw commented 1 year ago

Ya, I ran in to that error with librsvg today as well. I submitted an issue upstream: https://gitlab.gnome.org/GNOME/librsvg/-/issues/968

doadin commented 1 year ago

@danyeaw I saw the fixes merged so I tried a build again:

gvsbuild build --skip gtksourceview4 --skip emeus --skip clutter --skip cogl --configuration=release --platform=x64 --vs-ver=16 --enable-gi --py-wheel gtk3-full pycairo pygobject lz4 enchant

https://github.com/doadin/gvsbuild-release/actions/runs/5205425769/jobs/9390855310

doadin commented 1 year ago

@danyeaw so i started reducing down the command trying to see where this non-project is maybe getting put in and it seems like its just a problem parseing the skips maybe? with the above command it said cant find project c . Once I got it down to just

gvsbuild build --skip gtksourceview4 --skip emeus --configuration=release --platform=x64 --vs-ver=16 --enable-gi --py-wheel gtk3

It says can not find project e . Notice the last skip does not start with c and now starts with e .

doadin commented 1 year ago

@danyeaw sorry last @ gvsbuild build --platform=x64 --vs-ver=16 --enable-gi --py-wheel gtk3 pycairo pygobject lz4 enchant works so fairly positive I have narrowed it down to the skip option is still broke but in a different way :(

doadin commented 1 year ago

Unfortunately while the build gets far without skips, still fails: https://github.com/doadin/gvsbuild-release/actions/runs/5205711137/jobs/9391460212

the is filled with lines like:

C compiler for the host machine: cl (msvc 19.29.30148 "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30148 for x86") C linker for the host machine: link link 14.29.30148.0 Host machine cpu family: x86 Host machine cpu: x86

so idk how it is "finding" x86_64

danyeaw commented 1 year ago

Hi @doadin, for the last one it looks like you are trying to build with win32, but meson is finding x64 version of Python.

It may be possible to pass in the path of python as a meson option to pycairo using the python -m build --config-setting -Dpython=C:\path\to\python. However, it may just be easier to remove versions of Python you don't want to use off your Path in CI.

danyeaw commented 1 year ago

gvsbuild build --skip gtksourceview4 --skip emeus --skip clutter --skip cogl --configuration=release --platform=x64 --vs-ver=16 --enable-gi --py-wheel gtk3-full pycairo pygobject lz4 enchant

https://github.com/doadin/gvsbuild-release/actions/runs/5205425769/jobs/9390855310

I fixed this in https://github.com/wingtk/gvsbuild/commit/d29bbce075068bac50859be811b11e7748f113ca

doadin commented 1 year ago

@danyeaw yea I am not sure what the path looks like I am using setup-python action to manage python. Which seems like it puts the right python in place from my tests. But im not sure.

doadin commented 1 year ago

@danyeaw nvm I see a different python on path. Weird that setup-python doesnt already remove others?

doadin commented 1 year ago

I would think https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#using-update-environment-flag would handle this.

danyeaw commented 1 year ago

The runner comes with Python 3.9 installed before you run setup-python. https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md#language-and-runtime

This looks like a limitation of meson to me. If there are multiple versions of Python, it may not choose the Python that meson was run with. Setup-python looks like it is changing the default python, but it doesn't remove other versions on the path.

doadin commented 1 year ago

@danyeaw yea in the trace you can see it is being run from a different python than meson "found" and just running a python command you can see it running with the python version added by setup-python action. Im not sure how to remove the others from path but Ill figure it out. Thanks for the other fix!

doadin commented 1 year ago

@danyeaw well looks like removing all other python from path did not work. https://github.com/doadin/gvsbuild-release/actions/runs/5219121735/jobs/9420597840