AdaCore / Ada_Drivers_Library

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.
BSD 3-Clause "New" or "Revised" License
241 stars 142 forks source link

scripts/install_dependencies.py is unable to checkout the community-2019 branch #318

Closed WickedShell closed 4 years ago

WickedShell commented 4 years ago

Following the docs/how_to_create_my_own_adl_project.md on making a standalone project. When installing the runtimes it will fail as the branch already exists:

wickedshell@milton ~/code % mkdir project_root_dir
wickedshell@milton ~/code % cd project_root_dir 
wickedshell@milton ~/code/project_root_dir % git clone https://github.com/AdaCore/Ada_Drivers_Library.git Ada_Drivers_Library/repo/
Cloning into 'Ada_Drivers_Library/repo'...
remote: Enumerating objects: 152, done.
remote: Counting objects: 100% (152/152), done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 20303 (delta 55), reused 120 (delta 50), pack-reused 20151
Receiving objects: 100% (20303/20303), 18.06 MiB | 15.21 MiB/s, done.
Resolving deltas: 100% (13376/13376), done.
wickedshell@milton ~/code/project_root_dir % ./Ada_Drivers_Library/repo/scripts/install_dependencies.py
ROOT_DIR :/home/wickedshell/code/project_root_dir/Ada_Drivers_Library/repo
$ git clone https://github.com/AdaCore/bb-runtimes /home/wickedshell/code/project_root_dir/Ada_Drivers_Library/repo/bb-runtimes

$ git -C /home/wickedshell/code/project_root_dir/Ada_Drivers_Library/repo/bb-runtimes checkout -b community-2019 origin/community-2019

git branch checkout error (returned 128):
fatal: A branch named 'community-2019' already exists.

Running build command:
$ python /home/wickedshell/code/project_root_dir/Ada_Drivers_Library/repo/bb-runtimes/install.py --arch=arm-eabi

Dependency install command error (returned 1):
  File "/home/wickedshell/code/project_root_dir/Ada_Drivers_Library/repo/bb-runtimes/install.py", line 20
    print "usage: install.py [--arch=arm-eabi|aarch64-elf] [--prefix=<path>]"
                                                                            ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("usage: install.py [--arch=arm-eabi|aarch64-elf] [--prefix=<path>]")?

It also appears that scripts all require Python2. It's easy to invoke the install dependencies script with python2, however because this script itself launches scripts in bb_runtimes with python it dropped back to python3 again as that's the default on my system, which promptly broke the bb_runtimes script (due to at least print). If it used sys.executable to get the path before invoking the install script that would at least propagate the python2 runtime down.

Fabien-Chouteau commented 4 years ago

Hi @WickedShell ,

Thanks for the report, that's because the default branch of bb-runtimes changed.

I opened a PR to fix this: #320.