+ # Some packages, like stand-alone packages or virtual packages have no `ini` file associated.
+ var ini: nullable IniFile = null
+
+ # Array of relative source paths excluded according to the `source.exclude` key of the `ini`
+ var excludes: nullable Array[String] is lazy do
+ var ini = self.ini
+ if ini == null then return null
+ var exclude = ini["source.exclude"]
+ if exclude == null then return null
+ var excludes = exclude.split(":")
+ return excludes
+ end
+
+ # Does the source inclusion/inclusion rules of the package `ini` accept such path?
+ fun accept(filepath: String): Bool
+ do
+ var excludes = self.excludes
+ if excludes != null then
+ var relpath = root.filepath.relpath(filepath)
+ if excludes.has(relpath) then return false
+ end
+ return true
+ end
+
+ # Get the name to search for, for a `root_name` declared as `import` in `ini`
+ fun import_alias(root_name: String): nullable String
+ do
+ var map = import_aliases_parsed
+ if map == null then return null
+
+ var val = map.get_or_null(root_name)
+ if val == null then return null
+
+ return val.dir_name
+ end
+
+ private var import_aliases_parsed: nullable Map[String, ExternalPackage] is lazy do
+ var ini = ini
+ if ini == null then return null
+
+ var import_line = ini["package.import"]
+ if import_line == null then return null
+
+ var map = import_line.parse_import
+ if map.is_empty then return null
+
+ return map
+ end