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 smartcp

How to install smartcp

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install smartcp
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.1 Available View build log
0.1 Available View build log
 
Author
License
GPLv3+
Dependencies
Lastest release
version 0.1 on Sep 20th, 2013

This is an useful utility for automating copy from source and destination that can be customised by arguments that may vary. A good example of usage is available with this repo.

Install

You can install it from source by cloning this repo

System Message: ERROR/3 (<string>, line 16)

Unknown directive type "code-block".

.. code-block:: bash

    git clone https://github.com/blegat/smartcp.git

and running

System Message: ERROR/3 (<string>, line 22)

Unknown directive type "code-block".

.. code-block:: bash

    sudo python setup.py install

You can also install the latest released version through pip

System Message: ERROR/3 (<string>, line 28)

Unknown directive type "code-block".

.. code-block:: bash

    sudo pip install smartcp

or easy_install

System Message: ERROR/3 (<string>, line 34)

Unknown directive type "code-block".

.. code-block:: bash

    sudo easy_install smartcp

Requirements

It is officially only compatible with Python 3 and Python 2 but has some issues with accents for Python 2 (Python 3 has a better unicode approach than Python 2).

You will also need PyYAML.

Usage

You can get help by running

System Message: ERROR/3 (<string>, line 52)

Unknown directive type "code-block".

.. code-block:: bash

    smartcp -h

Config file

To specify which files to copy where, you need to specify a config file. It should use the YAML syntax. It contains a base path for the source, a base path for the destination and clients. For each client, you can specify some arguments (if no argument is given, there will be one copy but there can't be any node arg) and how to generate the source and destination from these arguments. To specify them you need to nest three types of nodes.

  • A path_format which can contain placeholders {n} and then parameters to replace them. The parameters can be one of the three nodes.
  • A mapping which contain a hash and a key which is a node.
  • An arg which is one of the arguments.

Here is an example which copies files from version/subversion/file to file-version.subversion while renaming file to b if it is a. It also copies 1/1/x to ../x-1.1.

System Message: ERROR/3 (<string>, line 80)

Unknown directive type "code-block".

.. code-block:: yaml

    input_base: .
    output_base: .
    clients:
      - name: Official
        arguments:
          subversion: [1, 2, 3]
          version: [1, 2, 3, 4, 5]
          file: [a, A, x, X]
        input:
          path_format: "{0}/{1}/{2}"
          parameters:
            - arg: subversion
            - arg: version
            - arg: file
        output:
          path_format: "{0}-{1}.{2}"
          parameters:
            - mapping:
                a: b
              key:
                arg: file
            - arg: version
            - arg: subversion
      - name: Simple copy
        input:
          path_format: 1/1/x
        output:
          path_format: ../x-1.1

Note the " for the path format because without it YAML won't understand that it is just a string.

Subscribe to package updates

Last updated Sep 20th, 2013

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.