Commit 1e3a14ff authored by Yuanle Song's avatar Yuanle Song
Browse files

only keep zero.el in pkg branch.

parent 72196558
Loading
Loading
Loading
Loading

Makefile

deleted100644 → 0
+0 −29
Original line number Original line Diff line number Diff line
VERSION := $(shell grep 'setq zero-version' zero-framework.el | cut -d'"' -f2)

default: dist
#===============
# multiple file
#===============
check:
	emacs -Q --batch -l zero-reload-all.el -f zero-rebuild -l zero-table.el -l zero-table-test.el -f ert-run-tests-batch
zip:
	git archive -o zero-el-$(VERSION).zip --prefix=zero/ HEAD
#==========================
# single file distribution
#==========================
dist: dist-check
build:
	if [ ! -x ~/.local/bin/pytest ]; then python3 -m pip install --user pytest; fi
	~/.local/bin/pytest build.py
	./build.py
	sed -i "s/PKG_VERSION/$(VERSION)/g" zero.el
dist-check: build
	emacs -Q --batch -l ~/.emacs.d/elpa/s-1.11.0/s.el -l zero.el -l zero-panel-test.el -l zero-pinyin-service-test.el -l zero-framework-test.el -l zero-pinyin-test.el -l zero-table.el -l zero-table-test.el -f ert-run-tests-batch
#====================
# other make targets
#====================
install-git-hooks:
	rsync -air git-hooks/ .git/hooks/
version:
	@echo $(VERSION)
.PHONY: default check zip dist build dist-check install-git-hooks version
+1 −1
Original line number Original line Diff line number Diff line
zero-el
zero-el
Copyright (C) 2019 Yuanle Song <sylecn@gmail.com>
Copyright (C) 2019 Yuanle Song <sylecn@gmail.com>


ibus-compute-pixel-position function in zero.el is copied from ibus.el.
zero--ibus-compute-pixel-position function in zero.el is copied from ibus.el.
This function is under GPLv3 license.  Copyright (C) 2010-2012 S. Irie
This function is under GPLv3 license.  Copyright (C) 2010-2012 S. Irie
+5 −0
Original line number Original line Diff line number Diff line
@@ -8,6 +8,11 @@ zero-el provides zero-pinyin, an Emacs pinyin input method for Chinese and
zero-framework, which is an emacs Chinese input method framework.
zero-framework, which is an emacs Chinese input method framework.


* File list
* File list
- zero.el

  It's a generated file for one-file package distribution. Not used for
  development.

- zero-framework.el
- zero-framework.el


  zero framework source code. This provides the framework and user interface
  zero framework source code. This provides the framework and user interface

build.py

deleted100755 → 0
+0 −74
Original line number Original line Diff line number Diff line
#!/usr/bin/env python3
# coding=utf-8

"""
build zero.el from zero.el.in and other el files
"""

import logging

logger = logging.getLogger(__name__)


def placeholder_for_file(fn):
    """return placeholder that should be used for filename.

    """
    return "INCLUDE_" + fn.replace('-', '_').replace('.', '_').upper()


def test_placeholder_for_file():
    assert placeholder_for_file("zero-panel.el") == "INCLUDE_ZERO_PANEL_EL"
    assert placeholder_for_file("zero-pinyin-service.el") == (
        "INCLUDE_ZERO_PINYIN_SERVICE_EL")


def get_el_file_body(fn):
    rows = []
    append = False
    with open(fn) as f:
        for line in f:
            if append:
                if '(require ' in line:
                    logger.debug("skipping require call: %s", line)
                    continue
                rows.append(line)
                if line.startswith('(provide'):
                    break
            else:
                if line.startswith(";;; Code:"):
                    rows.append(";; body of %s\n" % (fn,))
                    append = True
    return "".join(rows)


def expand_placeholder_for_files(old_content, filenames):
    """replace INCLUDE_FOO_BAR_EL by body of foo-bar.el.

    """
    result = old_content
    for fn in filenames:
        result = result.replace(placeholder_for_file(fn),
                                get_el_file_body(fn))
    return result


def main():
    logging.basicConfig(
        format='%(asctime)s [%(module)s] %(levelname)-8s %(message)s',
        level=logging.INFO)
    with open("zero.el.in") as tpl:
        content = tpl.read()
    expanded_content = expand_placeholder_for_files(content, [
        "zero-panel.el",
        "zero-framework.el",
        "zero-table.el",
        "zero-pinyin-service.el",
        "zero-pinyin.el",
        ])
    with open('zero.el', 'w') as out:
        out.write(expanded_content)


if __name__ == '__main__':
    main()

git-hooks/pre-commit

deleted100755 → 0
+0 −4
Original line number Original line Diff line number Diff line
#!/bin/sh
set -e
make dist-check
git add zero.el
Loading