Skip to content

Commit

Permalink
fix data files on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed May 8, 2011
1 parent 33e6ce8 commit 507d336
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions resources/win32/couchapp.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{0CDA65F1-9FD8-42C5-8DD0-F65F7E8B7304}
AppName=Couchapp
AppVerName=Couchapp 0.7.5
AppVerName=Couchapp 0.8.0
AppPublisher=Benoit Chesneau
AppPublisherURL=http:https://github.com/couchapp/couchapp
AppSupportURL=http:https://github.com/couchapp/couchapp
Expand All @@ -16,7 +16,7 @@ DefaultDirName={pf}\Couchapp
DefaultGroupName=Couchapp
LicenseFile=LICENSE
InfoAfterFile=resources\win32\postinstall.txt
OutputBaseFilename=couchapp-0.7.5
OutputBaseFilename=couchapp-0.8.0
Compression=lzma
SolidCompression=yes
SourceDir=..\..
Expand Down
35 changes: 22 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
def get_data_files():
data_files = []
data_files.append(('couchapp',
["LICENSE", "MANIFEST.in", "NOTICE", "README.md",
"THANKS.txt",]))
["LICENSE", "MANIFEST.in", "NOTICE", "README.rst",
"THANKS",]))
return data_files


Expand All @@ -100,14 +100,14 @@ def get_packages_data():

for root in ('templates',):
for curdir, dirs, files in os.walk(os.path.join("couchapp", root)):
print curdir
curdir = curdir.split(os.sep, 1)[1]
dirs[:] = filter(ordinarypath, dirs)
for f in filter(ordinarypath, files):
f = os.path.join(curdir, f)
f = os.path.normpath(os.path.join(curdir, f))
packagedata['couchapp'].append(f)
return packagedata


MODULES = [
'couchapp',
'couchapp.autopush',
Expand Down Expand Up @@ -146,6 +146,22 @@ def get_scripts():
"couchapp.bat"))
return scripts

DATA_FILES = get_data_files()


def get_py2exe_datafiles():
datapath = os.path.join('couchapp', 'templates')
head, tail = os.path.split(datapath)
d = dict(get_data_files())
for root, dirs, files in os.walk(datapath):
files = [os.path.join(root, filename) for filename in files]
root = root.replace(tail, datapath)
root = root[root.index(datapath):]
d[root] = files
return d.items()



if os.name == "nt" or sys.platform == "win32":
# py2exe needs to be installed to work
try:
Expand Down Expand Up @@ -181,6 +197,8 @@ def get_scripts():
except ImportError:
raise SystemExit('You need py2exe installed to run Couchapp.')

DATA_FILES = get_py2exe_datafiles()

class install_package_data(install_data):
def finalize_options(self):
self.set_undefined_options('install',
Expand Down Expand Up @@ -228,10 +246,7 @@ def build_extension(self, ext):

cmdclass = {'install_data': install_package_data }


def main():


# read long description
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
long_description = f.read()
Expand All @@ -240,12 +255,6 @@ def main():
for name in MODULES:
PACKAGES[name] = name.replace(".", "/")

DATA_FILES = [
('couchapp', ["LICENSE", "MANIFEST.in", "NOTICE", "README.rst",
"THANKS",])
]


options = dict(
name = 'Couchapp',
version = couchapp.__version__,
Expand Down

0 comments on commit 507d336

Please sign in to comment.