This repository was archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
WIP: Track feedstocks #24
Open
justcalamari
wants to merge
2
commits into
regro:master
Choose a base branch
from
justcalamari:feedstocks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import re | ||
|
||
from libcflib.tools import parse_meta_yaml | ||
|
||
sel_pat = re.compile(".+?\s*(#.*)?\[[^\[\]]+\](?(1)[^\(\)]*)$") | ||
ARCHS = ["linux-32", "linux-64", "linux-arm", "osx-64", "win-32", "win-64"] | ||
|
||
|
||
def has_selectors(meta_yaml): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add docstrings to these functions |
||
for line in meta_yaml.splitlines(): | ||
line = line.rstrip() | ||
if line.lstrip().startswith("#"): | ||
continue | ||
if sel_pat.match(line): | ||
return True | ||
return False | ||
|
||
|
||
def get_packages_from_recipe(recipe): | ||
outputs = recipe.get("outputs", recipe["package"]) | ||
packages = set() | ||
for package in outputs: | ||
packages.add(package) | ||
return packages | ||
|
||
|
||
def extract_packages_from_feedstock(feedstock, arch=None): | ||
packages = set() | ||
if not arch and has_selectors(feedstock.meta_yaml): | ||
for a in ARCHS: | ||
packages.update(extract_packages_from_feedstock(feedstock, arch=a)) | ||
elif arch: | ||
return get_packages_from_recipe(parse_meta_yaml(feedstock.meta_yaml, arch=arch)) | ||
else: | ||
return get_packages_from_recipe(parse_meta_yaml(feedstock.meta_yaml)) | ||
|
||
|
||
def get_feedstock_names(): | ||
git init feedstock | ||
with indir(feedstocks): | ||
git remote add origin git@github.com:conda-forge/feedstocks.git | ||
git config core.sparsecheckout true | ||
echo "feedstocks/" >> .git/info/sparse-checkout | ||
git pull --depth=1 origin master | ||
feedstocks = $(ls feedstocks/).splitlines() | ||
rm -rf feedstocks | ||
return feedstocks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ def render_meta_yaml(text): | |
return content | ||
|
||
|
||
def parse_meta_yaml(text): | ||
def parse_meta_yaml(text, arch=None): | ||
"""Parse the meta.yaml. | ||
|
||
Parameters | ||
|
@@ -96,9 +96,12 @@ def parse_meta_yaml(text): | |
|
||
""" | ||
|
||
config = Config() | ||
if arch: | ||
config.host_subdir = arch | ||
try: | ||
content = render_meta_yaml(text) | ||
return parse(content, Config()) | ||
return parse(content, config) | ||
except: | ||
return {} | ||
|
||
|
@@ -109,4 +112,4 @@ def indir(d): | |
old_d = os.getcwd() | ||
![cd @(d)] | ||
yield | ||
![cd @(old_d)] | ||
![cd @(old_d)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove indir if you want and use the xonsh lib for it. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the arches we don't care about