Giter VIP home page Giter VIP logo

Comments (3)

shareefj avatar shareefj commented on August 26, 2024

OK, how about the following. Instead of passing top_core in the EDAM dict, allow Fusesoc to expand environment variables and a special __CORE_PATH__ string. Perhaps there's a cleaner way of doing the same thing but my knowledge of the Fusesoc internals is limited.

diff --git a/fusesoc/capi2/core.py b/fusesoc/capi2/core.py
index ce17725..745cded 100644
--- a/fusesoc/capi2/core.py
+++ b/fusesoc/capi2/core.py
@@ -79,6 +79,21 @@ class String(str):
         )
 
 
+class StringWithVars(str):
+    """A string containing environment variables to expand and/or the special
+    __CORE_PATH__ variable that should be expanded to the dirname of the parent
+    core file. """
+    
+    def __init__(self, string):
+        self.string = os.path.expandvars(string)
+
+    def parse(self, core_root):
+        self.string = self.string.replace('__CORE_PATH__', core_root)
+
+    def __str__(self):
+        return self.string
+
+
 class Integer(int):
     pass
 
@@ -396,6 +411,8 @@ class Core:
                 if hasattr(section, member):
                     _member = getattr(section, member)
                     if _member:
+                        if isinstance(_member, StringWithVars):
+                            _member.parse(os.path.abspath(self.core_root))
                         options[member] = StringWithUseFlags(_member).parse(flags)
             for member in section.lists:
                 if hasattr(section, member):

from edalize.

olofk avatar olofk commented on August 26, 2024

I think the core functionality of the filelist plugin is useful and something people want, but I don't want to build in any special logic to find where the toplevel core file is located.

The closest thing I can give you is to do something like:

DIR=`fusesoc core show <your_core> | grep Core\ root | sed 's/^Core root: *//g'`
fusesoc run <your_core> --outpath=$DIR

which would give you the directory of the top level core file.

If that works for you, I think we can modify the backend to drop the top_core dependency. Otherwise I am fine with removing it for now and put this functionality back at a later point.

from edalize.

shareefj avatar shareefj commented on August 26, 2024

OK, let's take it out. That solution doesn't meet our requirements and I'm happy to maintain our own fork if we can't get a solution that doesn't require horrid work arounds.

from edalize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.