Skip to content

Commit

Permalink
[FIX] dirs listed line by line: simplifies not installing archiver
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreSchnizer committed Jul 10, 2024
1 parent dc64a63 commit 0d2ae9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 47 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
1# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: checking if packages install
Expand All @@ -14,28 +14,31 @@ jobs:

runs-on: ubuntu-latest
strategy:
fail-fast: True
fail-fast: False
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
with:
submodules: True
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- name: Install dependencies and packages
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install flake8 pytest
python -m pip install `python list_package_names.py`
# deliberatly omitting the archiver
python -m pip install `python list_package_names.py | grep -v archiver`
- name: Lint with flake8
run: |
Expand Down
45 changes: 4 additions & 41 deletions list_package_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,14 @@ def find_package_dirs(t_dir: str):
for file_path in setup_files:
package_dirs.add(os.path.dirname(file_path))

return list(package_dirs)


class PackageKey:
"""Priorise base packages
Hand coded what dependencies we have along the line
"""
def __init__(self):
self.counter = count()
self.core_custom_values = dict(core=1000, custom=5000)
self.core_values = {'math-utils' : -900, 'device-models' : -800}
self.custom_values = {'ophyd' : -900, 'bluesky' : -800}

def __call__(self, package_dirs: str):
root, *t_dirs = package_dirs.split('/')
val = self.core_custom_values[root]
if root == 'core':
pkg_name, = t_dirs
try:
val += self.core_values[pkg_name]
except KeyError:
pass
if root == 'custom':
L = len(t_dirs)
if L == 1:
# packages before specific machines
val -= 4000
elif L == 2:
pkg_name = t_dirs[1]
try:
val += self.custom_values[pkg_name]
except KeyError:
pass

return val #+ next(self.counter)
return package_dirs


def main():
"""Traverse directories executing install for appropriate ones"""
package_dirs = list(find_package_dirs("core/") + find_package_dirs("custom/"))
package_dirs.sort()
# package_dirs.sort(key=PackageKey())
"""Traverse directories listing the suitable ones"""
package_dirs = list(find_package_dirs("core/")) + list(find_package_dirs("custom/"))

print(" ".join([f"{t_dir}/" for t_dir in package_dirs]))
print("\n".join([f"{t_dir}/" for t_dir in package_dirs]))


if __name__ == "__main__":
Expand Down

0 comments on commit 0d2ae9d

Please sign in to comment.