Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install linkins

How to install linkins

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install linkins
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.0.4
0.0.7.4Never BuiltWhy not?
0.0.4 Available View build log
Windows (64-bit)
Mac OS X (10.5+)
0.0.4
0.0.7.4Never BuiltWhy not?
0.0.4 Available View build log
Linux (32-bit)
0.0.4
0.0.7.4Never BuiltWhy not?
0.0.4 Available View build log
Linux (64-bit)
0.0.7.4 Available View build log
0.0.4 Available View build log
 
License
MIT
Dependencies
Lastest release
version 0.0.7.4 on Jan 9th, 2014

Description

linkins is a command line tool which allows users to link a directory structure. It provides the ability to execute user-defined scripts at each level of the directory hierarchy.

Installation

Install using pip:

pip install linkins

or easy_install:

easy_install linkins

Usage

The linkins command takes two positional arguments: a list of directories which have the files to link and the destination directory. These show up in the help messages as TARGET_DIR and LINK_DIR, respectively:

linkins TARGET_DIR [TARGET_DIR ...] LINK_DIR

TARGET_DIRs are processed in the ordered specified by the user. Linkins also supports a number of optional arguments. To see all the supported options you can invoke the help menu:

linkins --help

Running scripts

Scripts are not run be default. In order to run your scripts you must pass the -r or --run option.

Linkins can run custom scripts at each directory. The only requirement is that the script name be the same everywhere. By default, linkins looks for scripts named linkins-script. But, the script name can be changed with the --script option. An example of a TARGET_DIR with scripts would be:

TARGET_DIR/
|-- .bashrc
|-- .emacs
|-- linkins-script
|-- .emacs.d
|   |-- linkins-script
|   |-- wc.el
|-- .xmonad
|   |-- xmonad.hs

Scripts must be executable. In Linux that means the executable bit must be set:

chmod +x SCRIPT_NAME

Scripts are not linked or copied to LINK_DIR. Instead, and for convenience, linkins passes three positional arguments to the script: TARGET_DIR, LINK_DIR and a relative path from TARGET_DIR to the script's parent directory. All paths are absolute except for the last positional argument just described. This includes the script itself. For example, the two scripts in the example above would be called like:

TARGET_DIR/linkins-script TARGET_DIR LINKS_DIR .
...
TARGET_DIR/.emacs.d/linkins-script TARGET_DIR LINKS_DIR .emacs.d

If the directory which mirrors the script's parent directory in the LINK_DIR side does not exist linkdirs will create it.

Any files in the same directory as the script are always linked before the script is run.

Multiprocessing

You can run each script as a separate process by using the -m or --multiprocess option. However, you must be aware of the consequences. For example, if you have two scripts that install packages from apt-get one of them will likely fail because it will not be able to obtain the dpkg lock.

Output

A script's output is read unbuffered and it is redirected to linkins' log where it is logged at level INFO. A script log line has the following form:

SCRIPT_PATH: SCRIPT: MSG

where SCRIPT_PATH is the relative path from TARGET_DIR to the script, SCRIPT is the word SCRIPT and MSG is the message outputted by the script to either STDOUT or STDERR.

If the -q option is used the script's output will be not be shown.

Command line options

--exclude

The --exclude option takes a list of arguments separated by whitespace. These arguments can be paths or regular expressions. Any directories or files in TARGET_DIR which match the arguments will be excluded from the operation. You can use --exclude in conjunction with any other operation.

--include

Without the --exclude option, this option doesn't have much use. You can use it to not exclude directories or files. Like --exclude it takes a list of arguments separated by whitespace which can be either paths or regular expressions.

--force

You can use the --force option to delete and relink links which already exist in LINK_DIR. Only links which link to files in TARGET_DIR will be replaced. Any other directories, files or links in LINK_DIR will be left untouched.

--clean

You can use the --clean option to delete links which already exist in LINK_DIR. Only links which link to files in TARGET_DIR will be removed. Any other directories, files or links in LINK_DIR will be left untouched. This operation has precedence over replacing links and running scripts. --clean will also remove empty parent directories.

Developing

External dependencies
  • python-dev
  • python-setuptools
  • python-virtualenv
Setup

To start developing run the following commands from the project's base directory. You can download the source from https://github.com/thelinuxkid/linkins:

# I like to install the virtual environment in a hidden repo.
virtualenv .virtual
# I leave the magic to Ruby developers (.virtual/bin/activate)
.virtual/bin/python setup.py develop
# At this point, linkins will already be in easy-install.pth.
# So, pip will not attempt to download it
.virtual/bin/pip install linkins[test]

If you like to use ipython you can install it with the dev requirement:

.virtual/bin/pip install linkins[dev]
Testing

To run the unit-tests run the following command from the project's base directory:

.virtual/bin/py.test

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.