Skip to content

Commit

Permalink
setup.py takes version from program and chmod 755 the plugins - fixes…
Browse files Browse the repository at this point in the history
… issue #9
  • Loading branch information
thomas-mangin committed Aug 21, 2014
1 parent 1f274d5 commit 3e55194
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,24 @@
import glob
from distutils.core import setup
from distutils.util import get_platform
from setuptools.command.install import install
from setuptools.command.easy_install import chmod

try:
version = os.popen('git describe --tags').read().split('-')[0].strip()
version = None
root = os.path.dirname(os.path.join(os.getcwd(),sys.argv[0]))
with open(os.path.join(root,'lib/exaproxy/application.py'),'r') as stream:
for line in stream:
if line.startswith("version = '"):
_,version,_ = line.split("'")
break
if version is None:
raise Exception()
if False in [ _.isdigit() for _ in version.split('.')]:
raise Exception()
print 'exaproxy version', version
except Exception,e:
print "can not find the hgtags file in the repository"
print "can not extract exaproxy version"
sys.exit(1)

def packages (lib):
Expand Down Expand Up @@ -47,6 +60,19 @@ def files ():
r.extend(configuration('etc/exaproxy'))
return r

class custom_install (install):
def run (self):
install.run(self)

if not self.dry_run:
for names in ( names for section,names in files() if section == 'etc/exaproxy/redirector'):
for name in names:
location = os.path.join(self.install_data,name)
chmod(location, 0755) # the 0 make the value octal
self.install_data



setup(name='exaproxy',
version=version,
description='non-caching http/https proxy',
Expand All @@ -72,4 +98,6 @@ def files ():
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
],
cmdclass={'install': custom_install},
)

0 comments on commit 3e55194

Please sign in to comment.