Skip to content

Commit

Permalink
Install extra deps using setuptools.config.read_configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
nocarryr committed Jun 2, 2021
1 parent 91dcc84 commit 57e3db3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/dist-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:
name: 'dists'
path: dist
- name: Install pip extras
run: pip install -r vidhubcontrol/kivyui/requirements.txt
run: |
KV_DEPS=$(./tools/get_setup_requires.py -e kivy)
pip install "$KV_DEPS"
- name: Delete source directory
run: rm -Rf vidhubcontrol
- name: Install wheel
Expand Down
39 changes: 39 additions & 0 deletions tools/get_setup_requires.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#! /usr/bin/env python

import argparse
from pathlib import Path
from setuptools.config import read_configuration


def parse_args():
p = argparse.ArgumentParser()
p.add_argument(
'-c', '--conf-file', dest='conf_file', default='setup.cfg',
help='Path to the setup.cfg file to read. Default is "%(default)s"',
)
p.add_argument(
'-e', '--extras', dest='extras',
help='Only show "extra" dependencies with the given name',
)
p.add_argument(
'-d', '--delimiter', dest='delimiter', default=' ',
help='Character(s) to separate the results. Default is "%(default)s"',
)
args = p.parse_args()
args.conf_file = Path(args.conf_file)
return args

def main():
args = parse_args()
conf = read_configuration(args.conf_file)
if args.extras:
try:
deps = conf['options']['extras_require'][args.extras]
except KeyError:
return
else:
deps = conf['options']['install_requires']
print(args.delimiter.join(deps))

if __name__ == '__main__':
main()

0 comments on commit 57e3db3

Please sign in to comment.