Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LibP2P-Daemon installation in setup.py #186

Merged
merged 17 commits into from
Mar 19, 2021
Merged

Fix LibP2P-Daemon installation in setup.py #186

merged 17 commits into from
Mar 19, 2021

Conversation

dvmazur
Copy link
Collaborator

@dvmazur dvmazur commented Mar 17, 2021

  • Rename ProtoCompileInstall and ProtoCompileDevelop to Install and Develop
  • Install LibP2P-Daemon on setup install and setup develop
  • Install Golang in Circle CI builds
  • Add p2pd binary to gitignore

@dvmazur dvmazur changed the title Test Fix LibP2P-Daemon installation in setup.py Mar 17, 2021
@dvmazur dvmazur requested review from xtinkt and justheuristic and removed request for xtinkt March 17, 2021 20:57
Copy link
Member

@justheuristic justheuristic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, let's use binaries in install mode, we just need to figure out how best to store them

@justheuristic justheuristic marked this pull request as ready for review March 17, 2021 23:50
@justheuristic
Copy link
Member

:note from @mryab :

  • check version when downloading (i.e. not just latest)
  • do not re-download p2pd if control sum matches the reference

setup.py Outdated
Comment on lines 53 to 55
def install_libp2p_daemon(build=False):
# verify golang installation if build flag is specified
if build:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In essence, you have two functions with entirely different code. It's best to separate them into two functions with different names

setup.py Show resolved Hide resolved
setup.py Outdated
Comment on lines 89 to 90
with cd(os.path.join(tempdir, 'go-libp2p-daemon-master', 'p2pd')):
status = os.system(f'go build -o {os.path.join(here, "hivemind/hivemind_cli", "p2pd")}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether the class cd is necessary. You can use the cwd argument for subprocess.run if you need to change the directory for your command

setup.py Outdated
Comment on lines 81 to 82
url = 'https://github.com/libp2p/go-libp2p-daemon/archive/master.tar.gz'
dest = os.path.join(tempdir, 'libp2p-daemon.tar.gz')
dest = os.path.join(tempdir, 'libp2p-daemon.tar.gz')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to change the URL to learning-at-home and to pin the version

Comment on lines 12 to 15
- run: |
wget https://golang.org/dl/go1.16.2.linux-amd64.tar.gz
tar -C ~/ -xzf go1.16.2.linux-amd64.tar.gz
echo "export PATH=~/go/bin:$PATH" >> $BASH_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to parametrize Go versions for all three pipelines with something like pipeline variables

setup.py Outdated
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move 4096 to a constant or at least an argument with default value

@dvmazur dvmazur requested a review from mryab March 19, 2021 19:00
@dvmazur dvmazur merged commit 6c22045 into libp2p Mar 19, 2021
@dvmazur dvmazur deleted the p2p-cli-fix branch March 19, 2021 19:13
justheuristic pushed a commit that referenced this pull request Apr 13, 2021
* Rename ProtoCompileInstall and ProtoCompileDevelop to Install and Develop
* Install LibP2P-Daemon on setup install and setup develop
* Install Golang in Circle CI builds
* Add P2PD binary to gitignore
MaximKsh pushed a commit that referenced this pull request Apr 20, 2021
* Rename ProtoCompileInstall and ProtoCompileDevelop to Install and Develop
* Install LibP2P-Daemon on setup install and setup develop
* Install Golang in Circle CI builds
* Add P2PD binary to gitignore
MaximKsh pushed a commit that referenced this pull request May 14, 2021
* Rename ProtoCompileInstall and ProtoCompileDevelop to Install and Develop
* Install LibP2P-Daemon on setup install and setup develop
* Install Golang in Circle CI builds
* Add P2PD binary to gitignore
MaximKsh pushed a commit that referenced this pull request May 14, 2021
* Rename ProtoCompileInstall and ProtoCompileDevelop to Install and Develop
* Install LibP2P-Daemon on setup install and setup develop
* Install Golang in Circle CI builds
* Add P2PD binary to gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants