Skip to content

Commit e1e63ac

Browse files
authored
Merge pull request #1008 from rayrapetyan/master
FreeBSD initial support
2 parents f1e8e91 + 73a869b commit e1e63ac

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Please see OS-specific instructions for:
8181
- [Linux](docs/README-linux.md#Developer-Setup)
8282
- [Mac](docs/README-osx.md#Developer-Setup)
8383
- [Windows](docs/README-windows.md#Developer-Setup)
84+
- [FreeBSD](docs/README-freebsd.md#Developer-Setup)
8485

8586
Then run these install commands:
8687

docs/README-freebsd.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Web3.py on FreeBSD (11.2)
2+
3+
## Developer Setup
4+
5+
### Prerequisites
6+
7+
Make sure you've UTF-8 defined for charset and lang in your [~/.login_conf](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-localization.html),
8+
otherwise almost every module will fail to install. Python 3 is very sensitive to that.
9+
10+
```
11+
sudo pkg install python3 py36-virtualenv leveldb libxml2 libxslt pkgconf secp256k1 wget git
12+
sudo wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/secp256k1/include/secp256k1_recovery.h -O /usr/local/include/secp256k1_recovery.h
13+
echo '#include "/usr/include/stdlib.h"' | sudo tee -a /usr/include/alloca.h > /dev/null
14+
mkdir -p /tmp/venv_python
15+
virtualenv-3.6 /tmp/venv_python/python3
16+
source /tmp/venv_python/python3/bin/activate.csh
17+
18+
# these two modules fail to install natively
19+
pip install ptyprocess eth-account
20+
21+
cd /tmp
22+
git clone https://github.com/ethereum/web3.py.git
23+
cd web3.py
24+
pip install -e .\[tester\] -r requirements-dev.txt --global-option=build_ext --global-option='-I/usr/local/include'
25+
```
26+
27+
## Test
28+
29+
#### Prerequisites for integration tests:
30+
31+
##### geth (https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-FreeBSD)
32+
```
33+
pkg install go
34+
cd /tmp
35+
git clone https://github.com/ethereum/go-ethereum
36+
cd go-ethereum
37+
make geth
38+
cp build/bin/geth /usr/local/bin/
39+
```
40+
41+
##### parity (https://github.com/paukstis/freebsd_parity/blob/v1.6/README.md)
42+
```
43+
BROKEN (build crashes on FreeBSD 11.2)
44+
```
45+
46+
```
47+
py.test tests/core
48+
py.test tests/ens
49+
py.test tests/integration
50+
```

docs/providers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ IPCProvider
246246
If no ``ipc_path`` is specified, it will use the first IPC file
247247
it can find from this list:
248248

249-
- On Linux:
249+
- On Linux and FreeBSD:
250250

251251
- ``~/.ethereum/geth.ipc``
252252
- ``~/.local/share/io.parity.ethereum/jsonrpc.ipc``

web3/providers/ipc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_default_ipc_path(testnet=False):
9191
if os.path.exists(ipc_path):
9292
return ipc_path
9393

94-
elif sys.platform.startswith('linux'):
94+
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
9595
ipc_path = os.path.expanduser(os.path.join(
9696
"~",
9797
".ethereum",
@@ -132,7 +132,7 @@ def get_default_ipc_path(testnet=False):
132132

133133
else:
134134
raise ValueError(
135-
"Unsupported platform '{0}'. Only darwin/linux2/win32 are "
135+
"Unsupported platform '{0}'. Only darwin/linux/win32/freebsd are "
136136
"supported. You must specify the ipc_path".format(sys.platform)
137137
)
138138

@@ -147,7 +147,7 @@ def get_dev_ipc_path():
147147
if os.path.exists(ipc_path):
148148
return ipc_path
149149

150-
elif sys.platform.startswith('linux'):
150+
elif sys.platform.startswith('linux') or sys.platform.startswith('freebsd'):
151151
ipc_path = os.path.expanduser(os.path.join(
152152
"/tmp",
153153
"geth.ipc"
@@ -176,7 +176,7 @@ def get_dev_ipc_path():
176176

177177
else:
178178
raise ValueError(
179-
"Unsupported platform '{0}'. Only darwin/linux2/win32 are "
179+
"Unsupported platform '{0}'. Only darwin/linux/win32/freebsd are "
180180
"supported. You must specify the ipc_path".format(sys.platform)
181181
)
182182

0 commit comments

Comments
 (0)