项目作者: anki-code

项目描述 :
Convert your xonsh fork package name to the new.
高级语言: Python
项目地址: git://github.com/anki-code/my-xonsh-fork.git
创建时间: 2020-11-01T11:30:09Z
项目社区:https://github.com/anki-code/my-xonsh-fork

开源协议:

下载



my-xonsh-fork is to convert your xonsh fork package name to the new
i.e. xonsh becomes xonsh42 and you can run it, add it to shebang or import in python.

How it works

  1. You have your own fork of original xonsh repository.
  2. You want to install it on your host. But you don’t want to lose the original xonsh on your host. You don’t want to rename xonsh package in your fork code to have an ability to pull the changes from the original xonsh repository without conflicts.
  3. When you run my-xonsh-fork it make a clone of the source git repo and replaces xonsh directory, calls, paths with the xonsh{FORK_NAME} i.e. xonsh2.
  4. Then you can install this package using pip.
  5. As result you’ll have xonsh on the host along with xonsh2. You can use both xonsh and xonsh2 in the sheband of your scripts i.e. #!/usr/bin/env xonsh2.

Install

  1. pip install my-xonsh-fork

Usage

  1. usage: my-xonsh-fork [-h] -n FORK_NAME -s SOURCE_REPO [-t TARGET_REPO] -d TARGET_DIR [-f]
  2. Convert your xonsh fork package name to the new.
  3. optional arguments:
  4. -h, --help show this help message and exit
  5. -n FORK_NAME, --fork-name FORK_NAME
  6. Fork name i.e. `-n 2` will create `xonsh2` fork.
  7. -s SOURCE_REPO, --source-repo SOURCE_REPO
  8. Source repo i.e. git@github.com:anki-code/xonsh-xep-2.git
  9. -t TARGET_REPO, --target-repo TARGET_REPO
  10. Target empty repo to push the result i.e. git@github.com:anki-code/xonsh2.git
  11. -d TARGET_DIR, --target-dir TARGET_DIR
  12. Target dir i.e. /tmp/xonsh2
  13. -f, --force-rebuild Remove XONSH_TARGET_DIR and rebuild from scratch.

Example

For example you want to have two packages: xonsh with original xonsh and xonsh2 - your fork of original xonsh.

To achieve this here is the example based on XEP-2 fork:

  1. my-xonsh-fork -n 2 -s git@github.com:anki-code/xonsh-xep-2.git -d /tmp/xonsh2 -f
  2. pip install -U /tmp/xonsh2
  3. xonsh2 --no-rc

If you want to push the renamed fork to new repo use --target-repo argument.

RC files

If your fork has name 2 (i.e. my-xonsh-fork -n 2 ...) then the new names of RC files will be: .xonshrc_2, rc_2.xsh.

xontrib

If your fork has name 2 (i.e. my-xonsh-fork -n 2 ...) then the new name of the xontribs package will be xontrib2 and the command to load it will be xontrib2 load.

To support your fork in the xontrib change the sections in setup.py of the xontrib:

  1. setup(
  2. ...
  3. packages=[
  4. 'xontrib',
  5. 'xontrib2' # Added
  6. ],
  7. package_dir={
  8. 'xontrib': 'xontrib',
  9. 'xontrib2': 'xontrib' # Added
  10. },
  11. ...
  12. )