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

FreeBSD initial support #1008

Merged
merged 3 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Please see OS-specific instructions for:
- [Linux](docs/README-linux.md#Developer-Setup)
- [Mac](docs/README-osx.md#Developer-Setup)
- [Windows](docs/README-windows.md#Developer-Setup)
- [FreeBSD](docs/README-freebsd.md#Developer-Setup)

Then run these install commands:

Expand Down
51 changes: 51 additions & 0 deletions docs/README-freebsd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Web3.py on FreeBSD (11.2)

## Developer Setup

### Prerequisites

#### As superuser
```
pkg install python3 py36-virtualenv leveldb libxml2 libxslt pkgconf secp256k1 wget git hs-pandoc
wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/secp256k1/include/secp256k1_recovery.h -O /usr/local/include/secp256k1_recovery.h
echo '#include "/usr/include/stdlib.h"' > /usr/include/alloca.h
```

#### As user
```
mkdir -p /tmp/venv_python
virtualenv-3.6 /tmp/venv_python/python3
source /tmp/venv_python/python3/bin/activate.csh

pip install eth-account ptyprocess

cd /tmp
git clone https://github.com/ethereum/web3.py.git
cd web3.py
pip install -e .\[tester\] -r requirements-dev.txt --global-option=build_ext --global-option='-I/usr/local/include'
```

## Test

#### Prerequisites for integration tests:

##### geth (https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-FreeBSD)
```
pkg install go
cd /tmp
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
make geth
cp build/bin/geth /usr/local/bin/
```

##### parity (https://github.com/paukstis/freebsd_parity/blob/v1.6/README.md)
```
BROKEN (build crashes on FreeBSD 11.2)
```

```
py.test tests/core
py.test tests/ens
py.test tests/integration
```
2 changes: 1 addition & 1 deletion docs/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ IPCProvider
If no ``ipc_path`` is specified, it will use the first IPC file
it can find from this list:

- On Linux:
- On Linux and FreeBSD:

- ``~/.ethereum/geth.ipc``
- ``~/.local/share/io.parity.ethereum/jsonrpc.ipc``
Expand Down
8 changes: 4 additions & 4 deletions web3/providers/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_default_ipc_path(testnet=False):
if os.path.exists(ipc_path):
return ipc_path

elif sys.platform.startswith('linux'):
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
ipc_path = os.path.expanduser(os.path.join(
"~",
".ethereum",
Expand Down Expand Up @@ -132,7 +132,7 @@ def get_default_ipc_path(testnet=False):

else:
raise ValueError(
"Unsupported platform '{0}'. Only darwin/linux2/win32 are "
"Unsupported platform '{0}'. Only darwin/linux/win32/freebsd are "
"supported. You must specify the ipc_path".format(sys.platform)
)

Expand All @@ -147,7 +147,7 @@ def get_dev_ipc_path():
if os.path.exists(ipc_path):
return ipc_path

elif sys.platform.startswith('linux'):
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
ipc_path = os.path.expanduser(os.path.join(
"/tmp",
"geth.ipc"
Expand Down Expand Up @@ -176,7 +176,7 @@ def get_dev_ipc_path():

else:
raise ValueError(
"Unsupported platform '{0}'. Only darwin/linux2/win32 are "
"Unsupported platform '{0}'. Only darwin/linux/win32/freebsd are "
"supported. You must specify the ipc_path".format(sys.platform)
)

Expand Down