[Tutor] Best solution to modifying code within a distributed library

Mats Wichmann mats at wichmann.us
Wed Sep 19 19:51:12 EDT 2018


On 09/19/2018 03:47 PM, Chip Wachob wrote:
> Hello once again,
> 
> I'm sure this is probably way outside my 'pay grade' but I would like
> to try an experiment and I'm not sure how to go about it.
> 
> I'm using the Adafruit FT232 libraries found here:
> 
> https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/SPI.py
> 
> I'm experiencing some wiggling of the IO lines when I configure the IO
> pin direction.
> 
> I've looked through the code in the FT232H.py file and found what I
> believe to be the culprit.
> 
> I would like to comment out line 340 (self.mpsse_write_gpio()) to
> prove that this is what is causing glitches that I do not want.
> 
> Using the .__file__ inside the interpreter I learned that the file is
> located here on my machine:
> 
> /usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/FT232H.pyc
> 
> But obviously, this is a binary file.
> 
> If I understand enough about Python, I believe that I need to edit the
> FT232H.py file in the .egg file to implement the change.  There is
> also likely some sort of compilation that needs to be done once the
> change is made...
> 
> BUT
> 
> As I've also learned from our friend Google, one should not be editing
> .egg files, etc.

You'll want to get the original and work from there. You already know
where it is - you've included the github link.

It's hard to know how much needs to be explained here... roughly, in
your project you want to clone the git tree, and make sure that's what
your experiment is picking up.  That would start as:

git clone https://github.com/adafruit/Adafruit_Python_GPIO.git

or of you want to start with something you might want to create a github
pull request to the maintainer, make sure you have a github account,
click the fork button on the github page, then in your own account find
the URL to give to "git clone" for your fork, and start from there.

to do an experiment, the former ought to be enough, but "there are more
details", depending on what you're familiar with as far as these tools.

Do write back with more questions if you go down this path...





More information about the Tutor mailing list