[gnoduino/gnoduino-0-3-0] Use share/arduino source when available
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino/gnoduino-0-3-0] Use share/arduino source when available
- Date: Wed, 28 Dec 2011 00:30:10 +0000 (UTC)
commit bbca8b960031bb53e33e0892f70d78342ca3f297
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Dec 28 01:28:20 2011 +0100
Use share/arduino source when available
Fixes bug #659311
setup.py | 43 +++++++++++++++++++------------------------
src/misc.py | 1 +
2 files changed, 20 insertions(+), 24 deletions(-)
---
diff --git a/setup.py b/setup.py
index a8f0c1e..68524bd 100644
--- a/setup.py
+++ b/setup.py
@@ -87,17 +87,6 @@ compline = "scripts/gen_programmers.py"
compline = "scripts/gitlog.sh"
(run, sout) = runProg(compline)
-
-data_files = [('share/gnoduino/ui', ['ui/main.ui', 'ui/arduino.xml']),
- ('share/gnoduino/', ['BOARDS', 'ChangeLog', 'NEWS', 'PROGRAMMERS', 'preferences.txt']),
- ('share/gnoduino/pixmaps', glob.glob('pixmaps/*.png')),
- ('share/gnoduino/scripts', ['scripts/gen_boards.py', 'scripts/gen_programmers.py']),
- ('share/man/man1', ['data/gnoduino.1']),
- ('share/applications', ['data/gnoduino.desktop']),
- ('share/pixmaps', ['pixmaps/gnoduino.png']),
-
-]
-
class install(_install):
def run(self):
if len(glob.glob('pixmaps/*.png')) == 0:
@@ -107,18 +96,24 @@ class install(_install):
# Run all sub-commands (at least those that need to be run)
_install.run(self)
-"""we ship hardware module"""
-for r,d,f in os.walk("hardware"):
- if ".git" not in r and f:
- data_files.append([os.path.join("share", "gnoduino", r), [os.path.join(r,i) for i in f]])
-"""we ship libraries module"""
-for r,d,f in os.walk("libraries"):
- if ".git" not in r and f:
- data_files.append([os.path.join("share", "gnoduino", r), [os.path.join(r,i) for i in f]])
-"""we ship reference module"""
-for r,d,f in os.walk("reference"):
- if ".git" not in r and f:
- data_files.append([os.path.join("share", "gnoduino", r), [os.path.join(r,i) for i in f]])
+def get_data_files():
+ data_files = [
+ ('share/gnoduino/ui', ['ui/main.ui', 'ui/arduino.xml']),
+ ('share/gnoduino/', ['BOARDS', 'ChangeLog', 'NEWS', 'PROGRAMMERS', 'preferences.txt']),
+ ('share/gnoduino/pixmaps', glob.glob('pixmaps/*.png')),
+ ('share/gnoduino/scripts', ['scripts/gen_boards.py', 'scripts/gen_programmers.py']),
+ ('share/man/man1', ['data/gnoduino.1']),
+ ('share/applications', ['data/gnoduino.desktop']),
+ ('share/pixmaps', ['pixmaps/gnoduino.png']),
+ ]
+ for subdir in ("hardware", "libraries", "reference"):
+ # We ship hardware/libraries/reference modules if not already installed
+ if not os.path.exists(os.path.join(sys.prefix, "share", "arduino", subdir)):
+ for dirpath, dirnames, filenames in os.walk(subdir):
+ if ".git" not in dirpath and filenames:
+ data_files.append([os.path.join("share", "gnoduino", dirpath),
+ [os.path.join(dirpath,i) for i in filenames]])
+ return data_files
setup(name='gnoduino',
version=get_gnoduino_version(),
@@ -132,7 +127,7 @@ setup(name='gnoduino',
url='http://gnome.eu.org/evo/index.php/Gnoduino',
license='GPL',
platforms='linux',
- data_files = data_files,
+ data_files = get_data_files(),
cmdclass={
"pixmaps": Pixmaps,
"install": install,
diff --git a/src/misc.py b/src/misc.py
index 4fe1358..cd37ecd 100644
--- a/src/misc.py
+++ b/src/misc.py
@@ -39,6 +39,7 @@ def get_path(main_path, default=None):
possible_paths = [
os.path.join(os.path.expanduser('~/.arduino'), main_path),
os.path.join(os.getcwd(), main_path),
+ os.path.join(sys.prefix, "share", "arduino", main_path),
os.path.join(sys.prefix, "local", "share", "gnoduino", main_path),
os.path.join(sys.prefix, "share", "gnoduino", main_path),
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]