diff options
Diffstat (limited to 'gs_elpa')
-rw-r--r-- | gs_elpa/__init__.py | 2 | ||||
-rw-r--r-- | gs_elpa/backend.py | 37 | ||||
-rw-r--r-- | gs_elpa/data/gs-elpa.eclass | 63 | ||||
-rw-r--r-- | gs_elpa/ebuild.py | 65 | ||||
-rw-r--r-- | gs_elpa/elpa_db.py | 130 |
5 files changed, 0 insertions, 297 deletions
diff --git a/gs_elpa/__init__.py b/gs_elpa/__init__.py deleted file mode 100644 index cf529d7..0000000 --- a/gs_elpa/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python - diff --git a/gs_elpa/backend.py b/gs_elpa/backend.py deleted file mode 100644 index 259fab6..0000000 --- a/gs_elpa/backend.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - backend.py - ~~~~~~~~~~ - - ELPA backend - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import os - -from g_sorcery.backend import Backend -from g_sorcery.metadata import MetadataGenerator -from g_sorcery.eclass import EclassGenerator -from g_sorcery.fileutils import get_pkgpath - -from .elpa_db import ElpaDBGenerator -from .ebuild import ElpaEbuildWithDigestGenerator, \ - ElpaEbuildWithoutDigestGenerator - - -class ElpaEclassGenerator(EclassGenerator): - """ - Implementation of eclass generator. Only specifies a data directory. - """ - def __init__(self): - super(ElpaEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data')) - - -#Backend instance to be loaded by g_sorcery -instance = Backend(ElpaDBGenerator, - ElpaEbuildWithDigestGenerator, ElpaEbuildWithoutDigestGenerator, - ElpaEclassGenerator, MetadataGenerator) diff --git a/gs_elpa/data/gs-elpa.eclass b/gs_elpa/data/gs-elpa.eclass deleted file mode 100644 index c4c85c6..0000000 --- a/gs_elpa/data/gs-elpa.eclass +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ -# automatically generated by gs-elpa -# please do not edit this file -# -# Original Author: Jauhien Piatlicki <piatlicki@gmail.com> -# Purpose: support installation of elisp packages for emacs -# from overlays generated by gs-elpa -# -# Bugs to piatlicki@gmail.com -# -# @ECLASS: gs-elpa.eclass -# -# @ECLASS-VARIABLE: REPO_URI -# @DESCRIPTION: address of a repository of elisp packages -# -# @ECLASS-VARIABLE: SOURCE_TYPE -# @DESCRIPTION: type of a package (single or tar) -# -# @ECLASS-VARIABLE: DIGEST_SOURCES -# @DESCRIPTION: whether manifest for sources exists -# -# @ECLASS-VARIABLE: REALNAME -# @DESCRIPTION: real name of a package in the repository -# - -inherit elisp g-sorcery - -EXPORT_FUNCTIONS src_{unpack,compile,install} - -if [[ ${SOURCE_TYPE} != "single" ]]; then - SUFFIX="${SOURCE_TYPE}" -else - SUFFIX="el" -fi - -SOURCEFILE=${REALNAME}-${PV}.${SUFFIX} - -gs-elpa_src_unpack() { - g-sorcery_src_unpack - if [[ ${SOURCE_TYPE} = "single" ]]; then - mkdir ${P} || die - mv ./${SOURCEFILE} ./${P}/${REALNAME}.${SUFFIX} || die - fi -} - -gs-elpa_src_compile() { - rm -f ${PN}-pkg.el || die - elisp-make-autoload-file || die - elisp_src_compile || die -} - -gs-elpa_src_install() { - local sitefile="50${PN}-gentoo.el" - cat <<EOF >> ${sitefile} || die -(add-to-list 'load-path "@SITELISP@") -(load "${PN}-autoloads" nil t) -EOF - elisp-site-file-install ${sitefile} || die - rm -f ${sitefile} || die - elisp_src_install || die -} diff --git a/gs_elpa/ebuild.py b/gs_elpa/ebuild.py deleted file mode 100644 index d1d63f2..0000000 --- a/gs_elpa/ebuild.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - ebuild.py - ~~~~~~~~~~~~~ - - ebuild generation - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import collections - -from g_sorcery.ebuild import DefaultEbuildGenerator - -Layout = collections.namedtuple("Layout", - ["vars_before_inherit", "inherit", - "vars_after_description", "vars_after_keywords"]) - - -class ElpaEbuildWithDigestGenerator(DefaultEbuildGenerator): - """ - Implementation of ebuild generator with sources digesting. - """ - def __init__(self, package_db): - - vars_before_inherit = \ - ["repo_uri", "source_type", "realname", {"name" : "digest_sources", "value" : "yes"}] - - inherit = ["g-sorcery", "gs-elpa"] - - vars_after_description = \ - ["homepage", {"name" : "src_uri", "value" : "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"}] - - vars_after_keywords = \ - ["depend", "rdepend"] - - layout = Layout(vars_before_inherit, - inherit, vars_after_description, vars_after_keywords) - - super(ElpaEbuildWithDigestGenerator, self).__init__(package_db, layout) - -class ElpaEbuildWithoutDigestGenerator(DefaultEbuildGenerator): - """ - Implementation of ebuild generator without sources digesting. - """ - def __init__(self, package_db): - - vars_before_inherit = \ - ["repo_uri", "source_type", "realname"] - - inherit = ["g-sorcery", "gs-elpa"] - - vars_after_description = \ - ["homepage"] - - vars_after_keywords = \ - ["depend", "rdepend"] - - layout = Layout(vars_before_inherit, inherit, - vars_after_description, vars_after_keywords) - - super(ElpaEbuildWithoutDigestGenerator, self).__init__(package_db, layout) diff --git a/gs_elpa/elpa_db.py b/gs_elpa/elpa_db.py deleted file mode 100644 index 8f8cd6d..0000000 --- a/gs_elpa/elpa_db.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - elpa_db.py - ~~~~~~~~~~ - - ELPA package database - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import sexpdata - -from g_sorcery.compatibility import py2k - -if py2k: - from urlparse import urljoin -else: - from urllib.parse import urljoin - -from g_sorcery.g_collections import Dependency, Package, serializable_elist -from g_sorcery.package_db import DBGenerator -from g_sorcery.exceptions import SyncError - -class ElpaDBGenerator(DBGenerator): - """ - Implementation of database generator for ELPA backend. - """ - def get_download_uries(self, common_config, config): - """ - Download database file from REPO_URI/archive-contents - and parse it with sexpdata. - - Args: - common_config: Backend config. - config: Repository config. - - Returns: - List with one URI entry. - """ - ac_uri = urljoin(config["repo_uri"], 'archive-contents') - return [{"uri" : ac_uri, "parser" : sexpdata.load}] - - def process_data(self, pkg_db, data, common_config, config): - """ - Process downloaded and parsed data and generate tree. - - Args: - pkg_db: Package database. - data: Dictionary with data, keys are file names. - common_config; Backend config. - config: Repository config. - """ - archive_contents = data['archive-contents'] - repo_uri = config["repo_uri"] - - if sexpdata.car(archive_contents) != 1: - raise SyncError('sync failed: ' \ - + repo_uri + ' bad archive contents format') - - pkg_db.add_category('app-emacs') - - PKG_INFO = 2 - PKG_NAME = 0 - - INFO_VERSION = 0 - INFO_DEPENDENCIES = 1 - INFO_DESCRIPTION = 2 - INFO_SRC_TYPE = 3 - - DEP_NAME = 0 - #DEP_VERSION = 1 #we do not use it at the moment - - for entry in sexpdata.cdr(archive_contents): - desc = entry[PKG_INFO].value() - realname = entry[PKG_NAME].value() - - if self.in_config([common_config, config], "exclude", realname): - continue - - pkg = Package("app-emacs", realname, - '.'.join(map(str, desc[INFO_VERSION]))) - source_type = desc[INFO_SRC_TYPE].value() - - allowed_ords = set(range(ord('a'), ord('z'))) \ - | set(range(ord('A'), ord('Z'))) | \ - set(range(ord('0'), ord('9'))) | set(list(map(ord, - ['+', '_', '-', ' ', '.', '(', ')', '[', ']', '{', '}', ',']))) - description = "".join([x for x in desc[INFO_DESCRIPTION] if ord(x) in allowed_ords]) - - deps = desc[INFO_DEPENDENCIES] - dependencies = serializable_elist(separator="\n\t") - for dep in deps: - dep = self.convert_dependency([common_config, config], - dep[DEP_NAME].value(), external = False) - if dep: - dependencies.append(dep) - - properties = {'source_type' : source_type, - 'description' : description, - 'dependencies' : dependencies, - 'depend' : dependencies, - 'rdepend' : dependencies, - 'homepage' : repo_uri, - 'repo_uri' : repo_uri, - 'realname' : realname, - #eclass entry - 'eclasses' : ['g-sorcery', 'gs-elpa'], - #metadata entries - 'maintainer' : [{'email' : 'piatlicki@gmail.com', - 'name' : 'Jauhien Piatlicki'}], - 'longdescription' : description - } - pkg_db.add_package(pkg, properties) - - def convert_internal_dependency(self, configs, dependency): - """ - At the moment we have only internal dependencies, each of them - is just a package name. - - Args: - configs: Backend and repo configs. - dependency: Package name. - - Returns: - Dependency instance with category="app-emacs", package="dependency". - """ - return Dependency("app-emacs", dependency) |