curry.toolchain.plans module

class curry.toolchain.plans.Plan(interp, flags, stages)[source]

Bases: object

A compilation plan.

Describes the sequence of stages that comprise compilation. Each stage consists of a set of file suffixes and a step function. The suffixes identify files at that stage. The step function implements the transition to the next stage.

filelist(curryfile)[source]
is_stale(filename, currypath=None)[source]

Tells whether a step of this plan refuses filename. A step refuses a file through its is_stale method, when it has one; see Json2Cpp and Cpp2So of the C++ backend and curry2icurry of the toolchain. The step of the file’s stage, which reads the file, is asked, and so is the step before it, which made the file. A step that answers for both its input and its output tells them apart by the suffix. currypath is the search path of the imports of the module (_findcurry.imports_path), for a step that imports them to answer (Cpp2So).

position(filename)[source]

Gives the current position in the plan.

prune_stale(filelist, currypath=None)[source]

Removes from filelist, the files of one module in the order of this plan, every file that a step refuses, and every file after it. A file that does not exist is kept, because nothing can be read from it. See is_stale; currypath is the search path of the imports of the module (_findcurry.imports_path).

restore(filename, currypath, **kwds)[source]

Asks the step that makes the final product of this plan to place a cached copy of the products of the module of filename beside its files (the product cache; see Cpp2So.restore of the C++ backend). Returns the file placed, or None when the step has no restore method, the cache is off, or the cache holds no entry. Maker.make asks before each step, so a module whose products are cached is neither generated nor compiled. kwds are the keywords of the plan (is_sourcefile among them).

property suffixes

Returns the sequence of file suffixes in this plan.

class curry.toolchain.plans.Stage(suffixes, step)

Bases: tuple

step

Alias for field number 1

suffixes

Alias for field number 0

curry.toolchain.plans.makeplan(interp=None, flags=0)[source]

Make a Plan object, which describes the compilation pipeline.

If interp is None, then the plan can only go as far as building ICurry-JSON.

Parameters:
  • interp – An optional interpreter used to assist in building objects. This defines the backend and is needed to perform certain build steps, such as the conversion from JSON to target code.

  • flags – Indicates which build stages are enabled.