Skip to content

load_setup_py_data should cd to the directory containing setup.py #3754

@jakirkham

Description

@jakirkham

Actual Behavior

Currently load_setup_py_data does not appear to cd to where the setup.py file lives. This is a non-issue if the setup.py is in the top-level of the working directory as in PR ( conda-forge/metawrap-feedstock#9 ). However if the source directory is a subdirectory as in PR ( https://github.com/conda-forge/metawrap-feedstock/pull/10/files ), the lack of using cd results in files appearing as missing. The result is things like versioneer end up failing when a subdirectory is involved and load_setup_py_data is used.

Expected Behavior

It would be nice if we cded to the directory where the setup.py file lives before running it.

Steps to Reproduce

This recipe encounters the issue. Dropping the src folder "fixes" the issue.

# filename: recipe/meta.yaml

{% set name = "metawrap" %}
{% set data = load_setup_py_data(setup_file="src/setup.py") %}
{% set version = data.get("version") %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  git_url: https://github.com/jakirkham/metawrap
  git_rev: HEAD
  folder: src

build:
  noarch: python
  number: 1
  script: python -m pip install --no-deps --ignore-installed .

requirements:
  host:
    - pip
    - python
    - setuptools

  run:
    - python

test:
  source_files:
    - tests

  imports:
    - metawrap

  commands:
    - python -m unittest discover -s .

about:
  home: http://github.com/jakirkham/metawrap
  license: BSD 3-Clause
  license_family: BSD
  license_file: LICENSE.txt
  summary: A collection of wrappers for functions and classes.
  doc_url: https://metawrap.readthedocs.io/
  dev_url: http://github.com/jakirkham/metawrap

extra:
  recipe-maintainers:
    - jakirkham
Output of conda info
$ conda info

     active environment : base
    active env location : /opt/conda
            shell level : 1
       user config file : /home/conda/.condarc
 populated config files : /home/conda/.condarc
          conda version : 4.7.12
    conda-build version : 3.18.9
         python version : 3.7.3.final.0
       virtual packages : 
       base environment : /opt/conda  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/conda/pkgs
                          /home/conda/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/conda/.conda/envs
               platform : linux-64
             user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.3 Linux/4.15.0-1059-azure centos/6.10 glibc/2.12
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False

Metadata

Metadata

Labels

locked[bot] locked due to inactivitystale[bot] marked as stale due to inactivitystale::closed[bot] closed after being marked as stale

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions