conda-forge / ninja-feedstock

A conda-smithy repository for ninja.
BSD 3-Clause "New" or "Revised" License
2 stars 18 forks source link

ninja package installs a broken ninja command #31

Closed PythonCHB closed 1 year ago

PythonCHB commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Installing ninja does not result in a functional ninja command:

(junk) chris@Chris-MacBook pytype % conda list ninja
# packages in environment at /Users/chris/miniconda3/envs/junk:
#
# Name                    Version                   Build  Channel
ninja                     1.11.0               h1b54a9f_0    conda-forge
(junk) chris@Chris-MacBook pytype % ninja
ninja: error: loading 'build.ninja': No such file or directory

NOTE: this example is with a bare-bones environment -- but I'm had teh same issue using it with other environments, e.g, with pytype (also broken:-( )

Installed packages

% conda list
# packages in environment at /Users/chris/miniconda3/envs/junk:
#
# Name                    Version                   Build  Channel
libcxx                    14.0.6               hccf4f1f_0    conda-forge
ninja                     1.11.0               h1b54a9f_0    conda-forge

Environment info

% conda info

     active environment : junk
    active env location : /Users/chris/miniconda3/envs/junk
            shell level : 1
       user config file : /Users/chris/.condarc
 populated config files : /Users/chris/.condarc
          conda version : 22.9.0
    conda-build version : not installed
         python version : 3.9.13.final.0
       virtual packages : __osx=11.6.2=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/chris/miniconda3  (writable)
      conda av data dir : /Users/chris/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/chris/miniconda3/pkgs
                          /Users/chris/.conda/pkgs
       envs directories : /Users/chris/miniconda3/envs
                          /Users/chris/.conda/envs
               platform : osx-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.13 Darwin/20.6.0 OSX/11.6.2
                UID:GID : 501:20
             netrc file : None
           offline mode : False
eli-schwartz commented 1 year ago

NOTE: this example is with a bare-bones environment -- but I'm had teh same issue using it with other environments, e.g, with pytype (also broken:-( )

The pytype problem is claiming that no "ninja" module exists when trying to run python -m ninja (this attempts to import ninja as a python package, then run its __main__ entrypoint.

This error is reporting that ninja ran successfully, but the purpose of ninja is to load a file called build.ninja and evaluate it as a kind of Makefile. And that file didn't exist, so it had nothing to do.

$ ninja
ninja: error: loading 'build.ninja': No such file or directory

$ ninja -f custom_rules.ninja
ninja: error: loading 'custom_rules.ninja': No such file or directory

$ python myscript.py
python: can't open file '/tmp/myscript.py': [Errno 2] No such file or directory

It's all the same class of error -- but neither python nor ninja is broken just because the file it tries to load doesn't exist.

(But ninja has a default file it will load if you don't pass -f to it. Python doesn't have a default file, it just opens an interactive REPL.)

PythonCHB commented 1 year ago

My mistake -- pardon my ignorance.

Closing this now.