Conda package contains no files

121 Views Asked by At

I am trying to create a conda package from a sample source that I have on github. The package is created but unfortunately the package contains no files. The package contains a folder called info. Inside there is a folder files but does not contain any files. Below is the folder structure.

-boost_test
 -meta.yaml
 -install-lib.bat
 -install-lib.sh

The contents in the meta.yaml is below

{% set version = "1.70.0" %}
        
        package:
          name: boost
          version: "1.70.0"
        
        source:
          url: https://github.com/sandybhat16/Boost/raw/main/boost_1_70_0.zip
          
        requirements:
          build:
            - python
            - setuptools
        
          run:
            - python
        
        outputs:
          - name: libboost-headers
            script: install-lib.sh   # [unix]
            script: install-lib.bat  # [win]

The contents in install-lib.bat are below

    @echo on
    
    if [%PKG_NAME%] == [libboost-headers] (
        REM for libboost-headers, only the headers
        robocopy temp_prefix\include %LIBRARY_INC% /E >nul
        if %ERRORLEVEL% EQU 1 echo OKCOPY
        REM robocopy leaves non-zero exit status as sign of success; clear it
        echo "robocopy done"
    ) else if [%PKG_NAME%] == [libboost] (
    REM only the libraries (don't copy CMake metadata)
    move temp_prefix\lib\boost*.lib %LIBRARY_LIB%
    move temp_prefix\lib\libboost*.lib %LIBRARY_LIB%
    REM dll's go to LIBRARY_BIN
    move temp_prefix\lib\boost*.dll %LIBRARY_BIN%
) else (
        REM everything else
        xcopy /E /Y temp_prefix\lib %LIBRARY_LIB%
    )

The contents in install-lib.sh are below

#!/bin/bash
set -ex

if [[ "$PKG_NAME" == "libboost-headers" ]]; then
    # for libboost-headers, only the headers;
    cp -R temp_prefix/include/. $PREFIX/include
elif [[ "$PKG_NAME" == "libboost" ]]; then
    # only the libraries (don't copy CMake metadata)
    cp -R temp_prefix/lib/libboost*${SHLIB_EXT}* $PREFIX/lib
    cp -R temp_prefix/lib/libboost*.a $PREFIX/lib
else
    # everything else
    if [[ "$target_platform" == "osx-arm64" ]]; then
        # osx-arm64 is special, because we need to generate signatures
        # for the libraries, which only happens on first installation;
        # if we overwrite the libs with the unsigned artefacts, conda
        # gets confused/unhappy, see #178;
        # therefore, copy already installed (=signed) libs into temp_prefix
        # before installation (=copy to $PREFIX), overwriting the unsigned
        # ones, ensuring that there's only one bit-for-bit variant per lib.
        cp $PREFIX/lib/libboost*.dylib temp_prefix/lib
    fi
    cp -R temp_prefix/lib/. $PREFIX/lib
fi

I run the conda build from boost_test directory using the command conda build .

Below is the log:

(base) C:\Conda test\boost_test>conda build .
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.22
Adding in variants from internal_defaults
Attempting to finalize metadata for libboost-headers
BUILD START: ['libboost-headers-1.70.0-0.tar.bz2']
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\_h_env


The following NEW packages will be INSTALLED:

    bzip2:           1.0.8-he774522_0       defaults
    ca-certificates: 2023.08.22-haa95532_0  defaults
    libffi:          3.4.4-hd77b12b_0       defaults
    openssl:         3.0.11-h2bbff1b_2      defaults
    pip:             23.3-py311haa95532_0   defaults
    python:          3.11.5-he1021f5_0      defaults
    setuptools:      68.0.0-py311haa95532_0 defaults
    sqlite:          3.41.2-h2bbff1b_0      defaults
    tk:              8.6.12-h2bbff1b_0      defaults
    tzdata:          2023c-h04d1e81_0       defaults
    vc:              14.2-h21ff451_1        defaults
    vs2015_runtime:  14.27.29016-h5e58377_2 defaults
    wheel:           0.41.2-py311haa95532_0 defaults
    xz:              5.4.2-h8cc25b3_0       defaults
    zlib:            1.2.13-h8cc25b3_0      defaults

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Source cache directory is: C:\Miniconda\miniconda3\conda-bld\src_cache
WARNING: No hash (md5, sha1, sha256) provided for boost_1_70_0.zip.  Source download forced.  Add hash to recipe to use source cache.
Found source in cache: boost_1_70_0.zip
Extracting download
source tree in: C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work
WARNING: Using legacy MSVC compiler setup.  This will be removed in conda-build 4.0. If this recipe does not use a compiler, this message is safe to ignore.  Otherwise, use {{compiler('<language>')}} jinja2 in requirements/build.
Packaging libboost-headers
Packaging libboost-headers-1.70.0-0

(base) C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work>call "C:\Miniconda\miniconda3\Scripts\..\condabin\conda_hook.bat"

(base) C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work>call "C:\Miniconda\miniconda3\Scripts\..\condabin\conda.bat" activate --stack "C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\_h_env"

EnvironmentLocationNotFound: Not a conda environment: C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\_h_env


(base) C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work>if [libboost-headers] == [libboost-headers] (
REM for libboost-headers, only the headers
 robocopy temp_prefix\include C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\_h_env\Library\include /E  1>nul
 if 1 EQU 1 echo OKCOPY
 REM robocopy leaves non-zero exit status as sign of success; clear it
 echo "robocopy done"
)  else (
REM everything else
 xcopy /E /Y temp_prefix\lib C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\_h_env\Library\lib
)
OKCOPY
"robocopy done"

Resource usage statistics from bundling libboost-headers:
   Process count: 1
   CPU time: Sys=0:00:00.0, User=-
   Memory: 3.7M
   Disk usage: 506.1K
   Time elapsed: 0:00:02.1


number of files: 0
Fixing permissions
INFO :: Time taken to mark (prefix)
        0 replacements in 0 files was 0.00 seconds
WARNING: Importing conda-verify failed.  Please be sure to test your packages.  conda install conda-verify to make this message go away.
TEST START: C:\Miniconda\miniconda3\conda-bld\win-64\libboost-headers-1.70.0-0.tar.bz2
WARNING: Multiple meta files found. The meta.yaml file in the base directory (C:\Users\z0049e7r\AppData\Local\Temp\tmpn83k3zbs\info\recipe) will be used.
Adding in variants from C:\Users\z0049e7r\AppData\Local\Temp\tmpn83k3zbs\info\recipe\conda_build_config.yaml
Nothing to test for: C:\Miniconda\miniconda3\conda-bld\win-64\libboost-headers-1.70.0-0.tar.bz2
Renaming work directory 'C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work' to 'C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work_moved_boost-1.70.0-py311_0_win-64_main_build_loop'
shutil.move(work)=C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work, dest=C:\Miniconda\miniconda3\conda-bld\boost_1698217412354\work_moved_boost-1.70.0-py311_0_win-64_main_build_loop)
# Automatic uploading is disabled
# If you want to upload package(s) to anaconda.org later, type:


# To have conda build upload to anaconda.org automatically, use
# $ conda config --set anaconda_upload yes
anaconda upload ^
    C:\Miniconda\miniconda3\conda-bld\win-64\libboost-headers-1.70.0-0.tar.bz2
anaconda_upload is not set.  Not uploading wheels: []

INFO :: The inputs making up the hashes for the built packages are as follows:
{
  "libboost-headers-1.70.0-0": {
    "recipe": {}
  }
}


####################################################################################
Resource usage summary:

Total time: 0:01:25.5
CPU usage: sys=0:00:00.0, user=0:00:00.0
Maximum memory usage observed: 3.7M
Total disk usage observed (not including envs): 506.1K


####################################################################################
Source and build intermediates have been left in C:\Miniconda\miniconda3\conda-bld.
There are currently 21 accumulated.
To remove them, you can run the ```conda build purge``` command

I also tried using a bld.bat file with the below contents, but for some reason I am not able to access all the environment variables there.

@echo on
echo Src dir - %SRC_DIR%
echo Recipe dir - %RECIPE_DIR%
echo dir - %dir%
REM making directory temp_prefix
mkdir boost_headers
REM for boost_headers, only the headers
robocopy %LIBRARY_INC% boost_headers\include /E >nul
if %ERRORLEVEL% EQU 1 echo OKCOPY
REM robocopy leaves non-zero exit status as sign of success; clear it
echo "robocopy done"

Output with bld.bat file:

(%BUILD_PREFIX%) %SRC_DIR%>echo Src dir - %SRC_DIR%
Src dir - %SRC_DIR%

(%BUILD_PREFIX%) %SRC_DIR%>echo Recipe dir - C:\Conda_test\boost_test
Recipe dir - C:\Conda_test\boost_test

(%BUILD_PREFIX%) %SRC_DIR%>echo dir -
dir -

(%BUILD_PREFIX%) %SRC_DIR%>REM making directory temp_prefix

(%BUILD_PREFIX%) %SRC_DIR%>mkdir boost_headers

(%BUILD_PREFIX%) %SRC_DIR%>REM for boost_headers, only the headers

(%BUILD_PREFIX%) %SRC_DIR%>robocopy %PREFIX%\Library\include boost_headers\include /E  1>nul

(%BUILD_PREFIX%) %SRC_DIR%>if 0 EQU 1 echo OKCOPY

(%BUILD_PREFIX%) %SRC_DIR%>REM robocopy leaves non-zero exit status as sign of success; clear it

(%BUILD_PREFIX%) %SRC_DIR%>echo "robocopy done"
"robocopy done"

Anything I am doing wrong?

1

There are 1 best solutions below

0
On

I was able to resolve this by simplifying the scripts. Below is the working recipe.

Folder structure:

 -boost_test
     -meta.yaml
     -bld.bat

The contents in the meta.yaml is below

package:
  name: boost_headers
  version: "1.70.0"

source:
  fn: boost_1_70_0.zip
  url: https://github.com/sandybhat16/Boost/raw/main/boost_1_70_0.zip

build:
  number: 0

requirements:
  build:
    - python
    - bzip2 1.0.*
    - zlib 1.2.*

  run:
    - python
    - bzip2 1.0.*
    - zlib 1.2.*

about:
  home: http://www.boost.org/
  license: Boost Software License

The contents in bld.bat are below

@echo on
robocopy "boost" "%LIBRARY_INC%\boost" /E
if %ERRORLEVEL% EQU 1 echo OKCOPY