克隆我编辑的分叉 git 存储库时,更改不会反映出来,而是克隆原始存储库

When cloning my edited forked git repository the changes are not reflected and original repository is cloned instead

我的目标是 fork 一个原始存储库,对其进行编辑,然后将其克隆到我的 beaglebone black 上。

以下是现有存储库的链接: https://github.com/adafruit/Adafruit_Python_BNO055 https://github.com/adafruit/Adafruit_Python_GPIO

以下是我编辑的存储库分叉版本的链接: https://github.com/frank2597/Adafruit_Python_BNO055 https://github.com/frank2597/Adafruit_Python_GPIO

我做了一些改变... 在 Adafruit_Python_GPIO/Adafruit_GPIO/I2C.py 中,我在第 55 行将 I2C 总线更改为 2:

return 2

在 Adafruit_Python_GPIO/setup.py 中,我将第 32 行更改为:

url = 'https://github.com/frank2597/Adafruit_Python_GPIO/',

在 Adafruit_Python_BNO055/setup.py 中,我将第 27 行和第 28 行更改为:

url = 'https://github.com/frank2597/Adafruit_Python_BNO055/',

dependency_links =['https://github.com/frank2597/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.9.3'],

然后我克隆了 Adafruit_Python_BNO055 并使用 setup.py:

安装了依赖项 Adafruit_Python_GPIO
git clone https://github.com/frank2597/Adafruit_Python_BNO055.git
cd Adafruit_Python_BNO055
sudo python setup.py install

但是解压缩 Adafruit_GPIO-1.0.4-py2.7.egg 文件并查看位于此处的 I2C.py 文件:

/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.4-py2.7.egg/Adafruit_GPIO/GPIO.pyc

我注意到我的更改没有反映出来,I2C 总线仍设置为 1。它似乎仍在克隆原始存储库,而不是我编辑的分叉版本。有谁知道我可能做错了什么?谢谢你。

dependency_links 被宣布为过时,最终 removedpip 19.0 中。它的替代品是具有特殊语法的 install_requires(自 pip 19.1 起支持):

install_requires=[
    'package_name @ git+https://gitlab.com/<PRIVATE_ORG>/<PRIVATE_REPO>.git@<COMMIT_ID>'
]

https://pip.readthedocs.io/en/stable/reference/pip_install/#requirement-specifiers and https://www.python.org/dev/peps/pep-0440/#direct-references

这需要 pip install,包括 pip install .,不适用于 python setup.py install

在您的特定情况下,这意味着 Adafruit_Python_BNO055/setup.py 忽略 dependency_links 并从 PyPI 安装 Adafruit-GPIO。解决方案是完全删除 dependency_links 并使用 pipsetup.py 中的 install_requires 安装依赖项 Adafruit-GPIO:

install_requires=[
    'Adafruit-GPIO @ git+https://github.com/frank2597/Adafruit_Python_GPIO',
    'pyserial',
]