|
13 | 13 | with open(path.join(here, pkg_name, "version.py")) as f: |
14 | 14 | exec(f.read()) |
15 | 15 |
|
16 | | -with urllib.request.urlopen( |
17 | | - "https://raw.githubusercontent.com/flatironinstitute/CaImAn/master/requirements.txt" |
18 | | -) as f: |
19 | | - caiman_requirements = f.read().decode("UTF-8").split("\n") |
| 16 | +# TODO: Replace with `tomllib` once Python 3.10 support is dropped |
| 17 | +def fetch_and_parse_dependencies(url): |
| 18 | + # Fetch the pyproject.toml file |
| 19 | + with urllib.request.urlopen(url) as f: |
| 20 | + toml_content = f.read().decode("UTF-8") |
| 21 | + |
| 22 | + # Manually parse the dependencies section |
| 23 | + lines = toml_content.split('\n') |
| 24 | + dependencies = [] |
| 25 | + start_collecting = False |
| 26 | + |
| 27 | + for line in lines: |
| 28 | + line = line.strip() |
| 29 | + if line.startswith('dependencies = ['): |
| 30 | + start_collecting = True |
| 31 | + continue |
| 32 | + if start_collecting: |
| 33 | + if line.startswith(']'): |
| 34 | + break |
| 35 | + dependency = line.strip(',').strip('"') |
| 36 | + dependencies.append(dependency) |
| 37 | + |
| 38 | + return dependencies |
| 39 | + |
| 40 | +# URL of CaImAn's pyproject.toml file |
| 41 | +caiman_url = "https://raw.githubusercontent.com/flatironinstitute/CaImAn/main/pyproject.toml" |
| 42 | + |
| 43 | +# Fetch and parse dependencies |
| 44 | +caiman_requirements = fetch_and_parse_dependencies(caiman_url ) |
| 45 | + |
20 | 46 |
|
21 | | -caiman_requirements.remove("") |
22 | | -caiman_requirements.append("future") |
23 | 47 |
|
24 | 48 | setup( |
25 | 49 | name=pkg_name.replace("_", "-"), |
|
0 commit comments