Skip to content

Commit 1e0b3b1

Browse files
committed
metadata remodeling
1 parent e5d94d6 commit 1e0b3b1

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

plotdevice/__init__.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# encoding: utf-8
2-
"""PlotDevice | quartz-powered vector machine
2+
3+
#
4+
# 888 d8 888 ,e,
5+
# 888 88e 888 e88 88e d88 e88 888 ,e e, Y8b Y888P " e88'888 ,e e,
6+
# 888 888b 888 d888 888b d88888 d888 888 d88 88b Y8b Y8P 888 d888 '8 d88 88b
7+
# 888 888P 888 Y888 888P 888 Y888 888 888 , Y8b " 888 Y888 , 888 ,
8+
# 888 88" 888 "88 88" 888 "88 888 "YeeP" Y8P 888 "88,e8' "YeeP"
9+
# 888
10+
# 888
11+
#
12+
13+
"""Quartz-powered vector machine
314
415
Copyright (C) 2014 Samizdat Drafting Co.
516
A derivative of http://nodebox.net/code by Frederik De Bleser & Tom De Smedt
@@ -8,18 +19,14 @@
819
MIT Licensed (see README file for details)
920
"""
1021

11-
__title__ = 'plotdevice'
1222
__version__ = '0.9.1'
13-
__author__ = 'Christian Swinehart'
23+
__author__ = 'Christian Swinehart'
24+
__email__ = "drafting@samizdat.cc"
1425
__credits__ = 'Frederik De Bleser, Tom De Smedt, Just van Rossum, & Marcos Ojeda'
15-
__copyright__ = 'Copyright 2014 Samizdat Drafting Co.'
1626
__license__ = 'MIT'
1727

18-
# note whether the module is being used within the .app, via console.py, or from the repl
19-
import sys, re
20-
called_from = getattr(sys.modules['__main__'], '__file__', '<interactive>')
21-
is_windowed = bool(re.search(r'plotdevice(-app|/run/console)\.py$', called_from))
22-
in_setup = bool(called_from.endswith('setup.py'))
28+
# add the shared directory (for Libraries) to the path
29+
sys.path.append(os.path.join(os.getenv('HOME'), 'Library', 'Application Support', 'PlotDevice'))
2330

2431
# add the Extras directory to sys.path since every module depends on PyObjC and friends
2532
try:
@@ -32,18 +39,20 @@
3239
# print python exceptions to the console rather than silently failing
3340
objc.setVerbose(True)
3441

35-
# add any installed Libraries to the sys path
36-
from os import getenv
37-
from os.path import join
38-
sys.path.append(join(getenv('HOME'), 'Library', 'Application Support', 'PlotDevice'))
39-
4042
# the global non-conflicting token (fingers crossed)
4143
DEFAULT = '_p_l_o_t_d_e_v_i_c_e_'
4244

4345
# please excuse our technical difficulties
4446
class DeviceError(Exception):
4547
pass
4648

49+
# note whether the module is being used within the .app, via console.py, or from the repl
50+
import sys, re, os
51+
called_from = getattr(sys.modules['__main__'], '__file__', '<interactive>')
52+
is_windowed = bool(re.search(r'plotdevice(-app|/run/console)\.py$', called_from))
53+
in_setup = bool(called_from.endswith('setup.py')) # (for builds)
54+
55+
# populate the namespace (or don't) accordingly
4756
if is_windowed or in_setup:
4857
# if a script imports * from within the app/tool, nothing should be (re-)added to the
4958
# global namespace. we'll let the Sandbox handle populating the namespace instead.
@@ -61,3 +70,5 @@ class DeviceError(Exception):
6170
# context/canvas's internal ns
6271
globals().update(ctx._ns)
6372
__all__ = ctx._ns.keys()
73+
74+

setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@
3131
## Metadata ##
3232

3333
# PyPI fields
34-
NAME = 'PlotDevice'
34+
APP_NAME = 'PlotDevice'
35+
MODULE = APP_NAME.lower()
3536
VERSION = plotdevice.__version__
36-
AUTHOR = "Christian Swinehart"
37-
AUTHOR_EMAIL = "drafting@samizdat.cc"
37+
AUTHOR = plotdevice.__author__
38+
AUTHOR_EMAIL = plotdevice.__email__
39+
LICENSE = plotdevice.__license__
3840
URL = "http://plotdevice.io/"
39-
LICENSE = "MIT"
4041
CLASSIFIERS = (
4142
"Development Status :: 5 - Production/Stable",
4243
"Environment :: MacOS X :: Cocoa",
@@ -91,7 +92,7 @@
9192
def info_plist(pth='app/PlotDevice-Info.plist'):
9293
info = plistlib.readPlist(pth)
9394
# overwrite the xcode placeholder vars
94-
info['CFBundleExecutable'] = info['CFBundleName'] = NAME
95+
info['CFBundleExecutable'] = info['CFBundleName'] = APP_NAME
9596
return info
9697

9798
def update_plist(pth, **modifications):
@@ -384,7 +385,7 @@ def run(self):
384385

385386
# common config between module and app builds
386387
config = dict(
387-
name = NAME.lower(),
388+
name = MODULE,
388389
version = VERSION,
389390
description = DESCRIPTION,
390391
long_description = LONG_DESCRIPTION,

0 commit comments

Comments
 (0)