-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.pyc | ||
build/ | ||
MANIFEST | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
v0.1, 26/07/2014 -- Initial release. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include *.md | ||
include *.txt | ||
recursive-include docs *.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# plist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[metadata] | ||
description-file = README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
] | ||
) |