Skip to content

Commit

Permalink
Merge pull request #108 from gappleto97/develop
Browse files Browse the repository at this point in the history
Increment to protocol version 4
  • Loading branch information
LivInTheLookingGlass committed Nov 2, 2016
2 parents 71c7879 + a1c7566 commit 8b9bd36
Show file tree
Hide file tree
Showing 108 changed files with 11,930 additions and 2,072 deletions.
32 changes: 25 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,37 @@ engines:
- 98cf09e372b83a194bdf71107a97074a
- 2c1611a8d29d03a6f557fc3827aeeca0
- b084b705606f106fb116029b92e5a6cf
- 6672f12d51d66b93d2385affbf929e0a
- ebe4b23b4a9a763738af9399771ee5e9
- df7560f7cecb58026ae7d8dcd247ffba
- 159e8adf8a3e8cd61bb5e9de1c78da33
- 0511db0bfd510cdcfb2ecd080cbf8993
- 0d6601bfd2a9f00e972db6f0f594fea0
- d098e5074e270ba459e0dfb5fee17663
- 2d21bc6adeb012585bebc59cdbf51cac

eslint:
enabled: true
fixme:
enabled: true
radon:
enabled: true
gnu-complexity:
enabled: true
# nodesecurity:
# enabled: true
pep8:
enabled: true
ratings:
paths:
- "**.inc"
- "**.js"
- "**.jsx"
- "**.module"
- "**.php"
- "**.py"
- "**.rb"
- "**.h"
- "**.cpp"
- "**.c"
- "**.inc"
- "**.js"
- "**.jsx"
- "**.module"
- "**.php"
- "**.py"
- "**.rb"
exclude_paths: []
7 changes: 6 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if 0:
if False:
if __name__ == .__main__.:
if __name__ == .__main__.:

[paths]
source =
py_src/
build/*/py2p/
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c_src/* linguist-language=C
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
./docs/py2p/.build/*
./docs/py2p/.static/*
./docs/py2p/.templates/*
./docs/py2p/py2p/*
**.pyc
15 changes: 3 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[submodule "js_src/SHA"]
path = js_src/SHA
url = https://github.com/Caligatio/jsSHA
[submodule "js_src/BigInteger"]
path = js_src/BigInteger
url = https://github.com/peterolson/BigInteger.js
[submodule "js_src/pack"]
path = js_src/pack
url = https://github.com/ryanrolds/bufferpack
[submodule "js_src/zlib"]
path = js_src/zlib
url = https://github.com/imaya/zlib.js
[submodule "cp_src/zlib"]
path = c_src/zlib
url = https://github.com/madler/zlib
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
js_src/test_doc.js
c_src/
cp_src/
go_src/
jv_src/
py_src/
doc/
.rst
.yml
Makefile
MANIFEST.in
.coveragerc
setup.cfg
setup.py
34 changes: 34 additions & 0 deletions .scripts/appveyor_script.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
IF DEFINED PIP (
ECHO %PYTHON% %PYTHON_VERSION%%APPVEYOR_BUILD_FOLDER%
set HOME=%APPVEYOR_BUILD_FOLDER%
%PYPY%
%PIP% install --upgrade setuptools
%PIP% install pytest-coverage codecov cryptography wheel
cd %HOME%
%RUN% -m pytest -c setup.cfg --cov=./py_src/ ./py_src/ || goto :error
%RUN% setup.py sdist --universal
%PIP% install --no-index --find-links=.\\dist\\ py2p
%RUN% setup.py bdist_wheel
%RUN% setup.py build
FOR /F %%v IN ('%RUN% -c "import sys, sysconfig; print(\"{}.{}-{v[0]}.{v[1]}\".format(\"lib\", sysconfig.get_platform(), v=sys.version_info))"') DO SET BUILD_DIR=%%v
ren .coverage .covvv
%RUN% -m pytest -c setup.cfg --cov=build\\%BUILD_DIR% build\\%BUILD_DIR% || goto :error
ren .covvv .coverage.1
ren .coverage .coverage.2
%COV% combine
%COV% xml
%RUN% -c "import codecov; codecov.main('--token=d89f9bd9-27a3-4560-8dbb-39ee3ba020a5', '--file=coverage.xml')"
) ELSE (
dir C:\avvm\node
powershell -Command "Install-Product node $env:NODE"
npm install .
npm install -g mocha babel-cli
mocha js_src\\test\\* || goto :error
babel js_src --out-dir build\\es5
mocha build\\es5\\test\\* || goto :error
)
goto :EOF

:error
ECHO Failed with error #%errorlevel%.
exit /b %errorlevel%
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions .scripts/shippable_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set -e;
if [ $pyver ]; then
pip install codecov
make cpython pytestdeps
py.test -vv --cov=./py_src/ ./py_src/
python setup.py sdist --universal && pip install --no-index --find-links=./dist/ py2p
mv .coverage .covvv
make cpytest cov=true
mv .covvv .coverage.1
mv .coverage .coverage.2
coverage combine
coverage xml
codecov --token=d89f9bd9-27a3-4560-8dbb-39ee3ba020a5 --file=coverage.xml
elif [ $jsver ]; then
sudo apt-get install build-essential libssl-dev
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
command -v nvm
nvm install $jsver
nvm use $jsver
node --version
make jstest
make ES5test
fi
32 changes: 32 additions & 0 deletions .scripts/travis_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set -e;
if [ $pyver ]; then
if [ $pyver != pypy ] && [ $pyver != pypy3 ]; then
git clone https://github.com/gappleto97/terryfy;
source terryfy/travis_tools.sh;
get_python_environment $pydist $pyver;
fi
if [ $pyver == pypy ] || [ $pyver == pypy3 ]; then
brew install $pyver; export PYTHON_EXE=$pyver;
curl $GET_PIP_URL > $DOWNLOADS_SDIR/get-pip.py;
sudo $PYTHON_EXE $DOWNLOADS_SDIR/get-pip.py --ignore-installed;
export PIP_CMD="sudo $PYTHON_EXE -m pip";
fi
$PIP_CMD install virtualenv;
virtualenv -p $PYTHON_EXE venv;
source venv/bin/activate;
make cpython;
pip install pytest-coverage codecov wheel
py.test -vv --cov=./py_src/ ./py_src/
python setup.py sdist --universal && pip install --no-index --find-links=./dist/ py2p
python setup.py bdist_wheel
mv .coverage .covvv
make cpytest cov=true
mv .covvv .coverage.1
mv .coverage .coverage.2
python -m coverage combine;
python -m coverage xml;
codecov --token=d89f9bd9-27a3-4560-8dbb-39ee3ba020a5 --file=coverage.xml
else
make jstest;
make ES5test;
fi
39 changes: 20 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
osx_image: beta-xcode6.2
matrix:
allow_failures:
- env: Cov='true' pyver=pypy pydist=homebrew
- env: Cov='true' pyver=pypy3 pydist=homebrew
include:
- language: generic
python: 2.6
os: osx
env: Cov='true' pyver=2.6 pydist=homebrew
# pydist=macports
# - language: generic
# python: 2.6
# os: osx
# env: Cov='true' pyver=2.6 pydist=macports
- language: generic
python: 2.7
os: osx
Expand Down Expand Up @@ -40,19 +40,20 @@ matrix:
# python: pypy3
# os: osx
# env: Cov='true' pyver=pypy3 pydist=homebrew
- language: node_js
node_js: "6"
os: osx
- language: node_js
node_js: "5"
os: osx
- language: node_js
node_js: "4"
os: osx

before_install:
- if [ $pyver != pypy ] && [ $pyver != pypy3 ]; then git clone https://github.com/gappleto97/terryfy; source terryfy/travis_tools.sh; get_python_environment $pydist $pyver; fi
- if [ $pyver == pypy ] || [ $pyver == pypy3 ]; then brew install $pyver; PYTHON_EXE=$pyver; curl $GET_PIP_URL > $DOWNLOADS_SDIR/get-pip.py; sudo $PYTHON_EXE $DOWNLOADS_SDIR/get-pip.py --ignore-installed; PIP_CMD="sudo $PYTHON_EXE -m pip"; export PYTHON_EXE PIP_CMD; fi
- $PIP_CMD install virtualenv
- virtualenv -p $PYTHON_EXE venv
- source venv/bin/activate
# Everything after this is user editable
install:
- if [ $Cov == 'true' ]; then pip install pytest-coverage codecov; fi
- if [ $(($RANDOM % 2)) == 0 ] || [ $pyver == pypy ] || [ $pyver == pypy3 ]; then pip install cryptography; else pip install PyOpenSSL; fi
script:
- if [ $Cov == 'true' ]; then py.test -vv --cov=./py_src/ ./py_src/; fi
- if [ $Cov == 'false' ]; then py.test -vv; fi
after_success:
- if [ $Cov == 'true' ]; then python -m coverage combine; python -m coverage xml; codecov --token=d89f9bd9-27a3-4560-8dbb-39ee3ba020a5 --file=coverage.xml; fi
- sh ./.scripts/travis_script.sh

addons:
artifacts:
paths:
- $(find . -iname *.whl -type f | tr "\n" ":")
91 changes: 91 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Contributing
============

Issues
~~~~~~

You may submit an issue via `this link`_ if you have a GitHub account,
or `this one`_ if you do not.

Issues should have a description of the problem, as well as all of the
following, if possible

#. A log from this time
#. The output from ``node.status``

Big Fixes
~~~~~~~~~

Bug fixes should be submitted as a pull request. If you are submitting a
bug fix, please title it as such, and provide a description of the bug
you’re fixing.

Because I use waffle.io, I appreciate it if the description includes a
list like the following:

- Connects to #71
- Connects to #99
- Connects to #108

This associates the pull request with the related issues.

New Features
~~~~~~~~~~~~

New features should be submitted as a pull request. If you are
submitting a new feature, please title it as such, and provide a
description of it. Any new feature should maintain the current API where
possible, and make explicit when it does not. Your PR will not be merged
until the other implementations can be made to match it, so it helps if
you try to implement it in them as well.

Because I use waffle.io, I appreciate it if the description includes a
list like the following:

- Connects to #71
- Connects to #99
- Connects to #108

This associates the pull request with the related issues.

New Network Schemas
~~~~~~~~~~~~~~~~~~~

If you want to add a new network schema, the following things are
required. These are written for the Python implementation, but it
applies to the others where possible.

#. It must keep the current inheritence structure (ie, “socket”, daemon,
connection, inheriting from base\_socket, base\_daemon,
base\_connection)
#. It must use the current packet format (or any changes must be
propagated to the other schemas)
#. Where possible, it should use the same flags as the current OP-codes
#. Where possible, it should keep a similar API
#. Message handlers should use the ``register_handler`` mechanism

New Language Implementations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you would like to write an implementation in a new language, thank
you! Following these rules will make things much faster to merge, though
exceptions can be made if necessary.

#. The new implementation should be in a folder labelled lang\_src (ex:
py\_src)
#. Setup scripts should be in the top level folder
#. It must at minimum support the mesh network implementation
#. Where possible, it should maintain the current
inheritence/architecture scheme
#. Where possible, it should use the same flags as the current OP-codes
#. Where possible, it should keep a similar API
#. Where possible, it should have unit tests
#. Where reasonable, users should be able to register custom callbacks

When this is ready, submit this as a pull request. If you name it as
such, it will take priority over everything but critical bugfixes. After
a review, we will discuss possible changes and plans for future
modifications, and then merge.

.. _this link: https://github.com/gappleto97/p2p-project/issues/new
.. _this one: https://gitreports.com/issue/gappleto97/p2p-project
21 changes: 0 additions & 21 deletions LICENSE.CITest

This file was deleted.

10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include LICENSE
include CONTRIBUTING.md
include README.md
include setup.py
include .coveragerc
include py_src/*.rst
include py_src/*.py
include py_src/test/*.py

exclude MANIFEST.in

0 comments on commit 8b9bd36

Please sign in to comment.