Thong Nguyen
Thong Nguyen

Reputation: 291

Running easy_install along with / before python setup.py sdist

I have a dependency package that must install with easy_install

easy_install deps/my_deps_package.egg

My current steps:

It worked fine now, but I can not add my_deps_package.egg to requirements.txt and I want when running python setup.py sdist, it should install all of it.

I'm using tox for running the tests and seems it's don't have option to run easy_install before install package.

Is there anyway to using easy_install along with python setup.py process or with tox?

Upvotes: 0

Views: 197

Answers (1)

Shine
Shine

Reputation: 588

tox typically uses one install tool/command which can be set using install_command. It will pass both the packages defined in deps and your package to that install_command (defaults to python -m pip install {opts} {packages}(ARGV)). Having two different install commmands is therefor impossible. Hence we will have to create a workaround.

An approach could be:

  1. Turn off regular installation flow. (skipp_install = true)
  2. Use commands_pre to perform all installation commands in the correct order.
  3. Use regular commands for whatever you want to do.
[testenv]
skip_install = true
commands_pre = 
    easy_install deps/my_deps_package.egg
    python setup.py sdist
    python -m pip install -e .[dev] dist/my_package.tar.gz
commands =
    pytest

This way you still achieve some separation of concerns as your installation commands only live in commands_pre.

Bonus:

[testenv:something]
# This should inherite the pre_commands from [testenv]
commands = 
    # Do something else :)
    ls

Upvotes: 1

Related Questions