Skip to content

Commit

Permalink
Update setup.py for conda-build context
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp committed Feb 21, 2024
1 parent 58744bd commit 0148d13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions recipe/meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": "py_0",
"buildnum": "0",
"build": "py_1",
"buildnum": "1",
"name": "iotaa",
"packages": {
"dev": [
Expand Down
6 changes: 3 additions & 3 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package:
name: iotaa
version: 0.7.1
version: 0.7.1 # reset build number
source:
path: ../src
build:
include_recipe: false
noarch: python
number: 0
number: 1
requirements:
build:
- pip
Expand All @@ -23,4 +23,4 @@ test:
- pytest
about:
home: https://github.com/maddenp/iotaa
license: Apache-2.0
license: APACHE
8 changes: 5 additions & 3 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

from setuptools import find_packages, setup # type: ignore

recipe = os.environ.get("RECIPE_DIR", "../recipe")
with open(os.path.join(recipe, "meta.json"), "r", encoding="utf-8") as f:
meta = json.load(f)
if os.environ.get("CONDA_BUILD"):
meta = {x: os.environ["PKG_%s" % x.upper()] for x in ("name", "version")}
else:
with open("../recipe/meta.json", "r", encoding="utf-8") as f:
meta = json.load(f)

name_conda = meta["name"]
name_py = name_conda.replace("-", "_")
Expand Down

0 comments on commit 0148d13

Please sign in to comment.