Skip to content

Commit f71df1c

Browse files
committed
Now code supports freeze into exe
1 parent 86cf868 commit f71df1c

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: python
22
python:
3-
- "3.3"
43
- "3.4"
54
cache: pip
65
install:
76
- pip install -r requirements.txt
87
script:
8+
- python setup.py build
99
- nosetests

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ The goal of leet however is to be simpler and as user friendly as possible, maki
55
For a more complete description of the leet project, it has been decided to link the Sourceforge pages describing the software application as well as the encryption algorithm to be used.
66

77
Here: https://sourceforge.net/p/home-of-leet/wiki/browse_pages/
8+
9+
## Build instructions
10+
Use: python setup.py build

Diff for: driver.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
import os
66
import sys
77

8-
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
8+
if getattr(sys, 'frozen', False):
9+
# frozen
10+
dir_ = os.path.dirname(sys.executable)
11+
else:
12+
# unfrozen
13+
dir_ = os.path.dirname(os.path.realpath(__file__))
14+
15+
sys.path.append(os.path.join(dir_, "src"))
916

1017
import curses
1118
import logging

Diff for: requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
pycrypto >= 2.6
2-
psutil >= 5.4.3
1+
cx_freeze == 5.0.1
2+
pycrypto >= 2.6
3+
psutil >= 5.4.3

Diff for: setup.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/usr/bin/env python
22

3-
from setuptools import setup, find_packages
3+
import sys, os
4+
from cx_Freeze import setup, Executable
5+
6+
dir_ = os.path.dirname(os.path.realpath(__file__))
7+
sys.path.append(os.path.join(dir_, "src"))
48

59
setup(
610
name='leet',
711
version=1.0,
812
author='CCEx',
913
description='Encryption tool',
10-
license='GPLv3'
14+
license='GPLv3',
15+
executables = [Executable("driver.py")]
1116
)

Diff for: src/__init__.py

Whitespace-only changes.

Diff for: src/crypto.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def unpad(self, s):
6363
return s[:-ord(s[len(s) - 1:])]
6464

6565
def encrypt(self, data: str):
66-
if not isinstance(self.key, str):
66+
if not isinstance(self.key, str) and not isinstance(self.key, bytes):
6767
raise ValueError('Invalid key')
6868

6969
data = self.pad(data)
@@ -74,7 +74,7 @@ def encrypt(self, data: str):
7474
return base64.b64encode(C).decode('utf-8')
7575

7676
def decrypt(self, data: str) -> str:
77-
if not isinstance(self.key, str):
77+
if not isinstance(self.key, str) and not isinstance(self.key, bytes):
7878
raise ValueError('Invalid key')
7979

8080
data = base64.b64decode(data)

0 commit comments

Comments
 (0)