-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource directive : implementation + clang / llvm use case #208
resource directive : implementation + clang / llvm use case #208
Conversation
I am opening a PR early to receive advice particularly on:
|
when_spec = parse_anonymous_spec(when, pkg.name) | ||
resources = pkg.resources.setdefault(when_spec, []) | ||
# FIXME : change URLFetchStrategy with a factory that selects based on kwargs | ||
fetcher = URLFetchStrategy(**kwargs) |
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.
Would it be fine to have a factory in fetch_strategy.py
that accepts and parses kwargs
and returns the appropriate strategy? If so should it be a static method of FetchStrategy
? I mean something like:
class FetchStrategy(object):
@staticmethod
def create(**kwargs):
# Selects strategy based on required arguments
return strategy
The idea would be to handle cases in which resources are checked-out from repositories, e.g. if a support for @trunk
will be added to clang.
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.
There's already something like this in fetch_strategy.py
-- it's the for_package_version
method. It's more complicated than you need here because it allows you to supply some default args in the actual package class, e.g.:
class Foo(Package):
git = 'http://example.com/repo.git'
version('2.6', tag='v2.6')
version('2.7', tag='v2.7')
That should actually work and it'll instantiate git fetchers for both versions. For resources, that's not necessary (or desired) so I think a factory would work well. You could either do your static method, or you could add something like from_args()
down where from_url
and for_package_version
are.
I think the only code you really need is this, from the middle of for_package_version
:
for fetcher in all_strategies:
if fetcher.matches(args):
return fetcher(**args)
I believe I had a simpler version of this in its own method before, but it wasn't used anywhere so I just left it out rather than having dead code.
@tgamblin : I tried to change the code according to the comments. Please tell me if you see something that was not fixed appropriately. A couple of minor questions: In # This method is used to match fetch strategies to version()
# arguments in packages.
@classmethod
def matches(cls, args):
return any(k in args for k in cls.required_attributes) I was wondering if How should we treat build-time only dependencies? For instance TypeError: 'NoneType' object is not callable Should we in general add a dependency on |
Up to now, I was not able to set up the paths for some system headers correctly. I described the issue here for OpenMP: http://lists.llvm.org/pipermail/cfe-users/2015-December/000832.html but the same holds true for C++ standard headers if libc++ is compiled. The issue seems to show up when llvm and clang are compiled separately. |
…es (if they are archive URLs)
@tgamblin documentation, tests and maybe a bit of refactoring to remove duplicated logic are still on my todo list. Do you prefer to continue working within this PR or should we open another one later for those things? |
@alalazo: I think we can commit this one and open another for the other stuff. |
########## | ||
# @3.7.0 | ||
resource(name='compiler-rt', | ||
url='http://llvm.org/releases/3.7.0/compiler-rt-3.7.0.src.tar.xz', md5='383c10affd513026f08936b5525523f5', |
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.
FYI: It's on my todo list to allow referencing the package's own version in URLs, patch paths, etc. So you could write something like this:
http://llvm.org/releases/${spec.version}/compiler-rt-${spec.version}.src.tar.xz
I need to think about how to implement it but it shouldn't be so hard. I just want to get the syntax right. Not sure ${}
is the best way to substitute it, either.
@alalazo: do you consider this PR ready to merge? It looks good to me -- I'll test installing |
@tgamblin : I don't have objections merging this PR as it is, but I think there are two things you may want to consider adding / fixing:
|
@alalazo: I like the I think we should fix the 2nd thing before merging -- the clang configuration shouldn't require extra includes. Can you let me know when that is done? |
… and libc++ resource : support for finer grained linking of resources
As soon as you confirm the compilation goes fine and the include path issue has disappeared it, I think the PR could be merged. |
resource directive : implementation + clang / llvm use case
Build additional docker images that may be used by Travis for external facing CI. Also provide some basic system configuration for Ubuntu on our workstations.
…_into_jcsda_emc_spack_stack Merge release/1.2.0 into jcsda_emc_spack_stack
Changeset:
mirror
fetches resourcesNotes: