Skip to content

Commit 1c1a6f8

Browse files
Change versioning system to comply with PyPi
1 parent efea3d5 commit 1c1a6f8

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

js_src/p2p.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ function p2p() {
1313
};
1414
}
1515

16-
m.version = "0.2.1";
17-
m.build_num = "build.135"
16+
var protocol_version = "0.2";
17+
var node_policy_version = "136";
18+
19+
version = [protocol_version, node_policy_version].join('.');
1820
m.compression = ['gzip'];
1921

2022
// User salt generation pulled from: http://stackoverflow.com/a/2117523

py_src/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
## Constants
66

7-
* `version`: A string containing the major, minor, and patch release number. This version refers to the underlying protocol.
8-
* `build_num`: The build number associated with this version. This refers to the node and its policies.
9-
* `__version__`: A string containing both `version` and `build_num` separated by a `"+"`. This is guarunteed to be unique.
7+
* `__version__`: A string containing the major, minor, and patch release number. This version refers to the underlying protocol.
108
* `version_info`: A `tuple` version of the above
9+
* `protocol_version`: A string containing the major and minor release number. This refers to the underlying protocol
10+
* `node_policy_version`: A string containing the build number associated with this version. This refers to the node and its policies.
1111
* `uses_RSA`: This value says whether it is using the underlying `rsa` module. If `None`, it means neither `rsa` nor any of its fallbacks could be imported. Currently `False` means it relies on `PyCrypto`, and `True` means it relies on `rsa`.
1212
* `if uses_RSA is not None`
1313
* `decryption_error`: The error a call to `decrypt` will throw if decryption of a given ciphertext fails
@@ -36,7 +36,8 @@ This is used mostly for inheriting common functions with [`mesh.py`](#meshpy) an
3636
## Constants
3737

3838
* `version`: A string containing the major, minor, and patch release number. This version refers to the underlying protocol.
39-
* `build_num`: The build number associated with this version. This refers to the node and its policies.
39+
* `protocol_version`: A string containing the major and minor release number. This refers to the underlying protocol
40+
* `node_policy_version`: A string containing the build number associated with this version. This refers to the node and its policies.
4041
* `user_salt`: A `uuid4` which is generated uniquely in each running instance
4142
* `compression`: A `list` of the compression methods your instance supports
4243
* `default_protocol`: The default [`protocol`](#protocol) definition. This uses an empty string as the subnet and `PKCS1_v1.5` encryption, as supplied by [`net.py`](#netpy) (in alpha releases this will use `Plaintext`)

py_src/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
77
Constants
88
9-
* version: A string containing the major, minor, and patch release number. This version refers to the underlying protocol.
10-
* build_num: The build number associated with this version. This refers to the node and its policies.
11-
* __version__: A string containing both version and build_num separated by a "+". This is guarunteed to be unique.
9+
* __version__: A string containing the major, minor, and patch release number.
10+
* protocol_version: A string containing the major and minor release number. This refers to the underlying protocol
11+
* node_policy_version: A string containing the build number associated with this version. This refers to the node and its policies.
1212
* version_info: A tuple version of the above
1313
* uses_RSA: This value says whether it is using the underlying rsa module. If None, it means neither rsa nor any of its fallbacks could be imported. Currently False means it relies on PyCrypto, and True means it relies on rsa.
1414
@@ -48,7 +48,7 @@
4848

4949
from .mesh import mesh_socket
5050
# from .chord import chord_socket
51-
from .base import version, build_num
51+
from .base import version as __version__
5252

5353
try:
5454
from .net import uses_RSA, decryption_error, verification_error, newkeys,\
@@ -58,8 +58,7 @@
5858
warnings.warn("Could not import encrypted socket module. Please install rsa from pip.", ImportWarning)
5959
uses_RSA = None
6060

61-
__version__ = version + "+" + build_num
62-
version_info = tuple(map(int, version.split("."))) + (build_num.split('.')[0],) + tuple(map(int, build_num.split('.')[1:]))
61+
version_info = tuple(map(int, __version__.split(".")))
6362

6463
__all__ = ["mesh", "chord", "base"]
6564

py_src/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
import bz2, hashlib, json, select, socket, struct, time, threading, traceback, uuid, zlib
55
from collections import namedtuple, deque
66

7-
version = "0.2.1"
8-
build_num = "build.135"
7+
protocol_version = "0.2"
8+
node_policy_version = "136"
9+
10+
version = '.'.join([protocol_version, node_policy_version])
911

1012
class flags():
1113
"""A namespace to hold protocol-defined flags"""
@@ -120,7 +122,7 @@ class protocol(namedtuple("protocol", ['subnet', 'encryption'])):
120122
"""Defines service variables so that you can reject connections looking for a different service"""
121123
@property
122124
def id(self):
123-
h = hashlib.sha256(''.join([str(x) for x in self] + [version]).encode())
125+
h = hashlib.sha256(''.join([str(x) for x in self] + [protocol_version]).encode())
124126
return to_base_58(int(h.hexdigest(), 16))
125127

126128
default_protocol = protocol('', "Plaintext") # PKCS1_v1.5")

py_src/test/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_protocol(iters=200):
145145
test = base.protocol(sub, enc)
146146
assert test.subnet == test[0] == sub
147147
assert test.encryption == test[1] == enc
148-
p_hash = hashlib.sha256(''.join([sub, enc, base.version]).encode())
148+
p_hash = hashlib.sha256(''.join([sub, enc, base.protocol_version]).encode())
149149
assert int(p_hash.hexdigest(), 16) == base.from_base_58(test.id)
150150

151151
def test_message_sans_network(iters=1000):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
'Programming Language :: JavaScript',
2626
'Operating System :: OS Independent',
2727
'Topic :: Communications',
28-
'Topic :: Internet'])
28+
'Topic :: Internet'])

0 commit comments

Comments
 (0)