API¶
Only the below API should be considered public.
Enthought egg features¶
EggMetadata class¶
This models the metadata of an Enthought egg:
metadata = EggMetadata.from_egg("numpy-1.7.1-1.egg")
print(metadata.platform_tag)
-
class
okonomiyaki.file_formats.EggMetadata(raw_name, version, platform, python, abi_tag, dependencies, pkg_info, summary, metadata_version=None)[source]¶ Enthought egg metadata for format 1.x.
-
abi_tag= None¶ The ABI tag, following the PEP425 format, except that no ABI is sorted as None.
-
build¶ The build number.
-
egg_basename¶ The egg “base name”, i.e. the name part of the egg filename.
-
egg_name¶ The egg filename.
-
classmethod
from_egg(path_or_file, strict=True)[source]¶ Create a EggMetadata instance from an existing Enthought egg.
- path: str or file-like object.
- If a string, understood as the path to the egg. Otherwise, understood as a zipfile-like object.
- strict: bool
- If True, will fail if metadata cannot be decoded correctly (e.g. unicode errors in EGG-INFO/PKG-INFO). If false, will ignore those errors, at the risk of data loss.
-
metadata_version= None¶ The version format of the underlying metadata.
-
name¶ The package name.
-
pkg_info= None¶ A PackageInfo instance modeling the underlying PKG-INFO. May be None for eggs without an PKG-INFO file.
-
platform= None¶ The platform, as a Platform instance.
-
platform_tag¶ Platform tag following PEP425, except that no platform is represented as None and not ‘any’.
-
python= None¶ The python implementation.
-
runtime_dependencies= None¶ List of runtime dependencies (as strings).
-
summary= None¶ The summary string.
-
version= None¶ The version, as an EnpkgVersion instance.
-
EggBuilder class¶
This is a class to build Enthought eggs from an install tree
-
class
okonomiyaki.file_formats.EggBuilder(egg_metadata, compress=True, cwd=None)[source]¶ Class to build eggs from an install tree. This is mostly useful to build Enthought eggs for non-python packages (C/C++ libraries, etc...)
-
add_data(data, archive_name)¶ Write the given data as the given archive name.
-
add_file(path, archive_prefix='')¶ Add the given file to the egg, under the given archive prefix.
-
add_file_as(path, archive_name)¶ Add the given file to the egg, under the given archive name.
-
add_iterator(iterator)¶ Add the files specified by the given iterator.
- iterator: iterator
- An iterator yielding (path, arcname) pairs.
-
add_tree(directory, archive_prefix='')¶ Add the given directory to the egg, under the given archive_prefix.
- directory: path
- A path to a directory. Every file in this directory will be included, recursively.
-
commit()¶ Commit the metadata, and close the file.
-
EggBuilder class¶
This is a class to build Enthought eggs from an existing setuptools egg.
-
class
okonomiyaki.file_formats.EggRewriter(egg_metadata, egg, compress=True, cwd=None, rename=None, accept=None, allow_overwrite=False)[source]¶ Class to create Enthought eggs from existing setuptools eggs.
-
add_data(data, archive_name)¶ Write the given data as the given archive name.
-
add_file(path, archive_prefix='')¶ Add the given file to the egg, under the given archive prefix.
-
add_file_as(path, archive_name)¶ Add the given file to the egg, under the given archive name.
-
add_iterator(iterator)¶ Add the files specified by the given iterator.
- iterator: iterator
- An iterator yielding (path, arcname) pairs.
-
add_tree(directory, archive_prefix='')¶ Add the given directory to the egg, under the given archive_prefix.
- directory: path
- A path to a directory. Every file in this directory will be included, recursively.
-
Runtimes¶
Runtime metadata factory¶
This class allows you to parse jaguar runtime format, through its factory class methods.
-
class
okonomiyaki.runtimes.IRuntimeMetadata(metadata_version)[source]¶ The metadata of a runtime package (i.e. the actual zipfile containing the runtime code).
-
classmethod
factory_from_path(path)[source]¶ Creates a metadata instance from the given path.
The created instance’s class will be detected dynamically from the metadata file content.
-
filename¶ The filename a runtime with this set of metadata.
-
classmethod
Platforms representations¶
The main API is EPDPlatform. You can either create an explicit platform, or try to guess the platform from the running system:
platform = EPDPlatform.from_epd_string("rh5-32")
platform = EPDPlatform.from_running_system()
One can access details through EPDPlatform instances’ attributes.
-
class
okonomiyaki.platforms.EPDPlatform(platform, **kw)[source]¶ An sane Canopy/EPD platform representation.
Example:
epd_platform = EPDPlatform.from_epd_string("rh5-32") assert epd.name == "rh5" assert epd.arch_bits == "32" assert epd.arch == "x86"
-
arch_bits¶ The number of bits (as a string) of this epd platform.
-
classmethod
from_epd_string(s)[source]¶ Create a new instance from an epd platform string (e.g. ‘win-32’)
Note: new, more explicit architecture names are also supported, e.g. ‘win-x86’ or ‘win-x86_64’ are supported.
-
classmethod
from_running_python()[source]¶ Attempt to create an EPDPlatform instance by guessing the running python. May raise an OkonomiyakiError exception
-
classmethod
from_running_system(arch_name=None)[source]¶ Attempt to create an EPDPlatform instance by guessing the running platform. May raise an OkonomiyakiError exception
- arch_name: str, None
- If given, must be a valid architecture string (e.g. ‘x86’). If None, will be guessed from the running platform.
-
platform¶ Main name of the platform (e.g. ‘rh5’)
-
Generic platform representations are available through the Platform class.
-
class
okonomiyaki.platforms.Platform(os, name, family, arch, machine=None, release='')[source]¶ An sane generic platform representation.
-
arch¶ Actual architecture. The architecture is guessed from the running python.
-
family¶ The ‘kind’ of platforms. For example, both debian and ubuntu distributions share the same kind, ‘debian’.
-
classmethod
from_running_python()[source]¶ Guess the platform, using the running python to guess the architecture.
-
classmethod
from_running_system(arch_string=None)[source]¶ Guess the platform, with an optional architecture string.
- arch_string: str, None
- If given, should be a valid architecture name (e.g. ‘x86’)
-
machine¶ The machine (e.g. ‘x86’). This is the CPU architecture (e.g. a 32 bits python running on 64 bits Intel OS will be ‘amd64’, whereas arch will be ‘x86’)
-
name¶ The most specific platform description
-
os¶ The most generic OS description
-
release¶ The release string. May be empty
-
Repositories format¶
Classes in this module model our different index entries.
GritsEggEntry can be used to automatically create the grits key, tags and metadata from an egg package.
-
class
okonomiyaki.repositories.GritsEggEntry(*args, **kw)[source]¶ This class models an egg entry metadata as required by Grits.
Example
>>> entry = GritsEggEntry.from_egg("numpy-1.7.1-1.egg", "rh5-32", "free") # Grits key, metadata and tags are available as simple properties >>> entry.grits_key >>> entry.grits_metadata >>> entry.grits_tags
-
egg_name¶ The egg filename.
-
classmethod
from_egg(path, platform, repository_type='commercial', qa_level='stable')[source]¶ Create a GritsEggEntry from an egg package.
- Parameters: str
- Path to the egg
- platform: str
- The consolidated platform (e.g. ‘rh5-32’)
- repository_type: str
- Type of repository: ‘commercial’ or ‘free’
-
version¶ The upstream version (not including the build number).
-