Ich verwende setuptools
zum ersten Mal und versuche, meinen Code so zu verpacken, dass andere ihn leicht entwickeln können. Ich betreibe alles in einer virtuellen Umgebung.Modul im Installationsmodus gefunden, aber nicht im Entwicklungsmodus mit setuptools
Kurze Frage: Wie ändere ich das Verzeichnis, auf das der Ei-Link zeigt, wenn ich python setup.py develop
ausführen?
Lange Frage: Das Modul, das ich entwickle, heißt cops_and_robots
. Wenn ich python setup.py install
ausführen, funktionieren die Dinge gut und ich bin in der Lage, mein cops_and_robots
Modul zu importieren. Allerdings, wenn ich laufen python setup.py develop
, läuft import cops_and_robots
schlägt fehl, da die cops_and_robots.egg-link
Punkte auf das falsche Verzeichnis:
(cops_and_robots)Antares:cops_and_robots nick$ cat ~/virtual_environments/cops_and_robots/lib/python2.7/site-packages/cops-and-robots.egg-link
/Users/nick/Downloads/cops_and_robots/
.
Hier wird die Verzeichnisstruktur ist:
|____Downloads
| |____cops_and_robots # the whole package directory
| | |____...
| | |____requirements.txt
| | |____setup.py
| | |____src
| | | |____cops_and_robots # the python package directory
| | | |______init.py__
| | |____...
Und mein setup.py
:
from setuptools import setup, find_packages
import ez_setup
ez_setup.use_setuptools()
setup(
# Author information and Metadata
name='cops_and_robots',
# Package data
packages=find_packages('src'),
package_dir={'cops_and_robots':'src/cops_and_robots'},
include_package_data=True,
platforms='any',
requires=['std_msgs','rospy'],
tests_require=['pytest'],
install_requires=[i.strip() for i in open("requirements.txt").readlines()],
)
Die Manuelles Update ist nur src/cops_and_robots
an die Datei cops_and_robots.egg-link
anhängen, aber ich suche nach einem elegan eine Möglichkeit, das zu tun.