Skip to content

Commit 7252c3f

Browse files
committed
Move server third-party packages to local-packages directory
1 parent e0e5a59 commit 7252c3f

File tree

17 files changed

+66
-37
lines changed

17 files changed

+66
-37
lines changed

ardublocklyserver/__init__.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
#
33
# ardublocklyserver package.
44
#
5-
# Copyright (c) 2015 carlosperate https://github.com/carlosperate/
5+
# Copyright (c) 2017 carlosperate https://github.com/carlosperate/
66
# Licensed under the Apache License, Version 2.0 (the "License"):
77
# http://www.apache.org/licenses/LICENSE-2.0
88
#
9-
# Explicit imports will be used, only version included here.
9+
# There is a specific requirements for this Python project to not need
10+
# external module dependencies, so all third-party modules have been carefully
11+
# chosen with this purpose in mind and included in a folder named
12+
# 'local-packages'. The sys.path has to be expanded to be able to import these.
1013
#
11-
__version__ = '0.1.2'
14+
import os
15+
import sys
16+
17+
# Adding the local-packages to the sys path
18+
local_packages_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
19+
'local-packages')
20+
sys.path.insert(0, local_packages_path)
21+
22+
# Follows Semantic Versioning 2.0.0 http://semver.org/spec/v2.0.0.html
23+
__version__ = '0.1.3-a'

ardublocklyserver/actions.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@
1313
import json
1414
import sys
1515
import os
16-
try:
17-
# 2.x name
18-
import Tkinter
19-
import urlparse
20-
import tkFileDialog
21-
except ImportError:
22-
# 3.x name
23-
import tkinter as Tkinter
24-
import urllib.parse as urlparse
25-
import tkinter.filedialog as tkFileDialog
26-
16+
# local-packages imports
17+
import six
18+
# Python 2 and 3 compatibility imports
19+
from six.moves import range
20+
from six.moves import tkinter as Tkinter
21+
from six.moves.urllib import parse as urlparse
22+
from six.moves import tkinter_tkfiledialog as tkFileDialog
23+
# This package modules
2724
from ardublocklyserver.compilersettings import ServerCompilerSettings
2825
from ardublocklyserver import sketchcreator
29-
import ardublocklyserver.six.six.moves as six_moves
30-
from ardublocklyserver.six import six
3126
import ardublocklyserver.gui as gui
3227

3328

@@ -105,7 +100,7 @@ def load_arduino_cli(sketch_path=None):
105100
print('CLI command: %s' % ' '.join(cli_command))
106101
# Python 2 needs the input to subprocess.Popen to be in system encoding
107102
if sys.version_info[0] < 3:
108-
for item in six_moves.range(len(cli_command)):
103+
for item in range(len(cli_command)):
109104
cli_command[item] = cli_command[item].encode(
110105
locale.getpreferredencoding())
111106

ardublocklyserver/compilersettings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
import re
1616
import sys
1717
import codecs
18-
# configparser port of the 3.5 version to support unicode across all versions
19-
from ardublocklyserver import configparser
18+
# local-packages imports
19+
import configparser
20+
# This package modules
2021
import ardublocklyserver.serialport
2122

2223

File renamed without changes.

ardublocklyserver/configparser/__init__.py renamed to ardublocklyserver/local-packages/configparser/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@
134134
import sys
135135
import warnings
136136

137-
from ardublocklyserver.configparser.helpers import OrderedDict as _default_dict
138-
from ardublocklyserver.configparser.helpers import ChainMap as _ChainMap
139-
from ardublocklyserver.configparser.helpers import from_none, open, str, PY2
137+
from configparser.helpers import OrderedDict as _default_dict
138+
from configparser.helpers import ChainMap as _ChainMap
139+
from configparser.helpers import from_none, open, str, PY2
140140

141141
__all__ = ["NoSectionError", "DuplicateOptionError", "DuplicateSectionError",
142142
"NoOptionError", "InterpolationError", "InterpolationDepthError",
File renamed without changes.
File renamed without changes.
File renamed without changes.

ardublocklyserver/six/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)