Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
panyam committed Mar 22, 2015
1 parent 48d2c92 commit 76188ba
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.pyc
build/
MANIFEST
dist/
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
v0.1, 26/07/2014 -- Initial release.

20 changes: 20 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Copyright (c) 2014 Sriram Panyam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.md
include *.txt
recursive-include docs *.txt
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# plist

6 changes: 6 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

* Implement constructors and methods (virtual or otherwise) in models
* Implement ability to add language specific verbatim tags in model as well as backend config.
* Write all types of backends for C++, Java and Python
* Documentation
* Unit tests
Empty file added plist/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions plist/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IVERSION = (0,1,6,12)
VERSION = ".".join(str(i) for i in IVERSION)
MINORVERSION = ".".join(str(i) for i in IVERSION[:2])
NAME = "plist"
NAMEVERSION = NAME + " " + VERSION
Empty file added requirements.txt
Empty file.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
104 changes: 104 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
from distutils.core import setup
import fnmatch
import os.path
from plist import version


def pdir():
dirname, _ = os.path.split(__file__)
return os.path.abspath(dirname)


def _fnmatch(name, patternList):
for i in patternList:
if fnmatch.fnmatch(name, i):
return True
return False


def _splitAll(path):
parts = []
h = path
while 1:
if not h:
break
h, t = os.path.split(h)
parts.append(t)
parts.reverse()
return parts


def findPackages(path, dataExclude=[]):
"""
Recursively find all packages and data directories rooted at path. Note
that only data _directories_ and their contents are returned -
non-Python files at module scope are not, and should be manually
included.
dataExclude is a list of fnmatch-compatible expressions for files and
directories that should not be included in pakcage_data.
Returns a (packages, package_data) tuple, ready to be passed to the
corresponding distutils.core.setup arguments.
"""
packages = []
datadirs = []
for root, dirs, files in os.walk(path, topdown=True):
if "__init__.py" in files:
p = _splitAll(root)
packages.append(".".join(p))
else:
dirs[:] = []
if packages:
datadirs.append(root)

# Now we recurse into the data directories
package_data = {}
for i in datadirs:
if not _fnmatch(i, dataExclude):
parts = _splitAll(i)
module = ".".join(parts[:-1])
acc = package_data.get(module, [])
for root, dirs, files in os.walk(i, topdown=True):
sub = os.path.join(*_splitAll(root)[1:])
if not _fnmatch(sub, dataExclude):
for fname in files:
path = os.path.join(sub, fname)
if not _fnmatch(path, dataExclude):
acc.append(path)
else:
dirs[:] = []
package_data[module] = acc
return packages, package_data


# Tell distutils to put the data_files in platform-specific installation
# locations. See here for an explanation:
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
# for scheme in INSTALL_SCHEMES.values(): scheme['data']=scheme['purelib']

print "PDIR: ", pdir(), os.listdir(pdir())
packages, package_data = findPackages("plist")

print "Packages: ", packages
print "Datafiles: ", package_data

setup(name="plist",
version=version.VERSION,
description="A package for managing Apple plist files.",
long_description=file(os.path.join(pdir(), "README.md")).read(),
author="Sri Panyam",
author_email="[email protected]",
url="http://github.com/panyam/plist/",
scripts=["./bin/plist"],
packages=packages,
package_data=package_data,
install_requires=[
"jinja2>=2.7"
],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
]
)

0 comments on commit 76188ba

Please sign in to comment.