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

None should be -1 in utility.py FindIndex #25

Open
Shadowblitz16 opened this issue Dec 28, 2022 · 3 comments
Open

None should be -1 in utility.py FindIndex #25

Shadowblitz16 opened this issue Dec 28, 2022 · 3 comments

Comments

@Shadowblitz16
Copy link

I kept getting

shadowblitz16@Node202-Debian:~/Documents/source/OS/Nano$ scons toolchain
scons: Reading SConscript files ...
TypeError: 'NoneType' object cannot be interpreted as an integer:
  File "/home/shadowblitz16/Documents/source/OS/Nano/SConstruct", line 139:
    SConscript('src/bootloader/stage2/SConscript', variant_dir=variantDir + '/stage2', duplicate=0)
  File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/shadowblitz16/.local/lib/python3.9/site-packages/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/shadowblitz16/Documents/source/OS/Nano/src/bootloader/stage2/SConscript", line 26:
    obj_crti = objects.pop(FindIndex(objects, lambda item: IsFileName(item, 'crti.o')))
  File "/usr/lib/python3.9/collections/__init__.py", line 1229:
    return self.data.pop(i)

everywhere because

def FindIndex(the_list, predicate):
    for i in range(len(the_list)):
        if predicate(the_list[i]):
            return i
    return None

should be...

def FindIndex(the_list, predicate):
    for i in range(len(the_list)):
        if predicate(the_list[i]):
            return i
    return -1

in build_scripts/utility.py

@chibicitiberiu
Copy link
Collaborator

The problem isn't that it's returning None. The problem is that it can't find crti.o in your object files.

@ghost
Copy link

ghost commented Oct 20, 2023

The problem isn't that it's returning None. The problem is that it can't find crti.o in your object files.

You may find the CMake build system a little easier to approach if your looking to keep things simple for your user base. I say this mainly due to some not having any previous Python knowledge to even make proper use of Scons

@chibicitiberiu
Copy link
Collaborator

chibicitiberiu commented Feb 14, 2024

You may find the CMake build system a little easier to approach if your looking to keep things simple for your user base. I say this mainly due to some not having any previous Python knowledge to even make proper use of Scons

I agree with you that SCons might be a bit much for a beginner. But having used CMake before, I don't find it any easier. I think moving away from make was the right decision, the more a project evolves, makefiles tend to get more unmaintainable and harder to understand, and any complex operation (like generating the disk image files) ends up as a shell script.

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

No branches or pull requests

2 participants