Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

packaging

  • Loading branch information...
commit 3094fd8a114f601a17fbe89f3f8596dcc9a643f2 1 parent d092e7d
@kmike kmike authored
View
1  .gitignore
@@ -1 +1,2 @@
*.pyc
+build/
View
0  gpl-2.0.txt → LICENSE.txt
File renamed without changes
View
49 bin/psdparser.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+import sys
+import logging
+from psdparse import psdparser
+
+if __name__ == '__main__':
+ """
+ Let's get started!
+ """
+
+ from optparse import OptionParser
+ parser = OptionParser(usage = "usage: %prog [OPTS] PSDFILE.psd")
+ po = parser.add_option
+
+ # Verbosity
+ po('-v', '--verbose', default=False, action='store_true')
+ po('-q', '--quiet', default=False, action='store_true')
+
+ (OPTS, args) = parser.parse_args()
+
+ # The global holder for all the information we really care about
+ info = {}
+
+ # Set the logger
+ level = logging.INFO
+ if OPTS.verbose:
+ level = logging.DEBUG
+ if OPTS.quiet:
+ level = logging.WARNING
+
+ handler = logging.StreamHandler()
+ handler.setFormatter(logging.Formatter('[DEBUG] %(message)s'))
+ psdparser.logger.addHandler(handler)
+ psdparser.logger.setLevel(level)
+
+ # Run
+ if len(args) == 1:
+ psd = psdparser.PSDParser(args[0])
+ psd.parse()
+
+ import yaml
+ print "# YAML automatically generated by psdparser\n"
+ print yaml.dump({'header': psd.header, 'ressources': psd.ressources, 'layers': psd.layers}, indent=2)
+
+ else:
+ parser.print_help()
+ sys.exit(1)
View
0  __init__.py → psdparse/__init__.py
File renamed without changes
View
44 psdparser.py → psdparse/psdparser.py
@@ -145,7 +145,7 @@
def INDENT_OUTPUT(depth, msg):
return ''.join([' ' for i in range(0, depth)]) + msg
-class PSDParser():
+class PSDParser(object):
header = None
ressources = None
@@ -647,45 +647,3 @@ def parse_image_data(self):
else:
raise ValueError('Unsupported mode or number of channels')
-if __name__ == '__main__':
- """
- Let's get started!
- """
-
- from optparse import OptionParser
- parser = OptionParser(usage = "usage: %prog [OPTS] PSDFILE.psd")
- po = parser.add_option
-
- # Verbosity
- po('-v', '--verbose', default=False, action='store_true')
- po('-q', '--quiet', default=False, action='store_true')
-
- (OPTS, args) = parser.parse_args()
-
- # The global holder for all the information we really care about
- info = {}
-
- # Set the logger
- level = logging.INFO
- if OPTS.verbose:
- level = logging.DEBUG
- if OPTS.quiet:
- level = logging.WARNING
-
- handler = logging.StreamHandler()
- handler.setFormatter(logging.Formatter('[DEBUG] %(message)s'))
- logger.addHandler(handler)
- logger.setLevel(level)
-
- # Run
- if len(args) == 1:
- psd = PSDParser(args[0])
- psd.parse()
-
- import yaml
- print "# YAML automatically generated by psdparser\n"
- print yaml.dump({'header': psd.header, 'ressources': psd.ressources, 'layers': psd.layers}, indent=2)
-
- else:
- parser.print_help()
- sys.exit(1)
View
33 setup.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+from distutils.core import setup
+
+setup(
+ name = 'psdparser',
+ version = '0.1',
+ author = 'Jeremy Bethmont',
+ author_email = 'jeremy.bethmont@gmail.com',
+ url = 'https://github.com/jerem/psdparse',
+
+ description = 'PSD parser',
+ long_description = open('README.txt').read(),
+
+ license = 'GPLv2',
+ packages = ['psdparse'],
+ scripts=['bin/psdparser.py'],
+ requires=['PyYAML', 'PIL'],
+
+ classifiers=[
+ 'Development Status :: 3 - Alpha',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.5',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Topic :: Multimedia :: Graphics',
+ 'Topic :: Multimedia :: Graphics :: Viewers',
+ 'Topic :: Multimedia :: Graphics :: Graphics Conversion',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+)

3 comments on commit 3094fd8

@palange

This commit broke my tool that was using psdparse. :(

@kmike

I'm sorry; it was probably better to extract "Let's get started!" functiona s "def main():" and leave it in psdparser.py (and reuse it in a script).

@palange

Its okay - It points out a deficiency in the way I build and deploy my tool. I was using psdparsers as a git submodule so its code was deployed in my tool's file structure. I should instead set up a virtualenv to deploy my tool scripts dependencies. The packaging you provided will help with that.

Please sign in to comment.
Something went wrong with that request. Please try again.