Skip to content

Commit 6d33754

Browse files
committed
Add conda recipe
To build the conda package: conda build conda-recipe Note that the version is automatically set according to the files generated by make_version.py, which is automatically run by the recipe
1 parent 688d1f6 commit 6d33754

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ dist/
44
.ropeproject/
55
MANIFEST
66
control/_version.py
7+
__conda_*.txt
8+
record.txt
79
build.log
810
*.egg-info/
911
.coverage

conda-recipe/bld.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd %RECIPE_DIR%\..
2+
%PYTHON% make_version.py
3+
%PYTHON% setup.py install --single-version-externally-managed --record=record.txt

conda-recipe/meta.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package:
2+
name: control
3+
4+
build:
5+
script:
6+
- cd $RECIPE_DIR/..
7+
- $PYTHON make_version.py
8+
- $PYTHON setup.py install --single-version-externally-managed --record=record.txt
9+
10+
requirements:
11+
build:
12+
- python
13+
14+
run:
15+
- python
16+
- numpy
17+
- scipy
18+
- matplotlib
19+
20+
test:
21+
requires:
22+
- nose
23+
24+
imports:
25+
- control
26+
27+
about:
28+
home: http://python-control.sourceforge.net
29+
license: BSD License
30+
summary: 'Python control systems library'
31+
32+
# See
33+
# http://docs.continuum.io/conda/build.html for
34+
# more information about meta.yaml

make_version.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ def main():
2222
fd.write('__version__ = "%s.post%s"\n' % (version, build))
2323
fd.write('__commit__ = "%s"\n' % (commit))
2424

25+
# Write files for conda version number
26+
SRC_DIR = os.environ.get('SRC_DIR', '.')
27+
conda_version_path = os.path.join(SRC_DIR, '__conda_version__.txt')
28+
print("Writing %s" % conda_version_path)
29+
with open(conda_version_path, 'w') as conda_version:
30+
conda_version.write(version)
31+
32+
conda_buildnum_path = os.path.join(SRC_DIR, '__conda_buildnum__.txt')
33+
print("Writing %s" % conda_buildnum_path)
34+
35+
with open(conda_buildnum_path, 'w') as conda_buildnum:
36+
conda_buildnum.write(build)
37+
2538

2639
if __name__ == '__main__':
2740
main()

0 commit comments

Comments
 (0)