Skip to content

Commit

Permalink
0.0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaeno committed Nov 8, 2019
1 parent 5e72a8d commit 81c6756
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes

* 11/8/2019
* 0.0.22
* enabled wheel
* fixed for pip+virtualenv

* 11/7/2019
* 0.0.21
* added python 2/3 compatibility
* added pip and virtual env support
Expand Down
32 changes: 25 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#
#

panda_user = 'atlpan'
panda_group = 'zp'

# set PYTHONPATH to use the current directory first
import sys
sys.path.insert(0,'.')
Expand All @@ -22,6 +19,16 @@
from setuptools import setup
from setuptools.command.install import install as install_org
from distutils.command.install_data import install_data as install_data_org

# user
if os.getgid() == 0:
panda_user = 'atlpan'
panda_group = 'zp'
else:
panda_user = getpass.getuser()
panda_group = grp.getgrgid(os.getgid()).gr_name

# package version
import PandaPkgInfo
release_version = PandaPkgInfo.release_version

Expand Down Expand Up @@ -105,9 +112,9 @@ def finalize_options (self):

def run (self):
# not to use wheel to correctly generate setup.sh
if 'bdist_wheel' in self.distribution.get_cmdline_options():
#if 'bdist_wheel' in self.distribution.get_cmdline_options():
# wheel is disabled
sys.exit('\n\033[32m'+'WARNING : Wheel is disabled. Please try installation from source'+'\033[0m')
# sys.exit('\n\033[32m'+'WARNING : Wheel is disabled. Try installation from source'+'\033[0m')
# setup.py install sets install_dir to /usr
if self.install_dir == '/usr':
self.install_dir = '/'
Expand Down Expand Up @@ -187,13 +194,24 @@ def run (self):
self.data_files = new_data_files
install_data_org.run(self)

#post install
# post install
uid = pwd.getpwnam(panda_user).pw_uid
gid = grp.getgrnam(panda_group).gr_gid
for directory in ['/var/log/panda', '/var/log/panda/wsgisocks', '/var/log/panda/fastsocks']:
directory = self.virtual_env + directory
if not os.path.exists(directory):
os.makedirs(directory)
os.chown(directory, uid, gid)
os.chown(directory, uid, gid)
if self.virtual_env != '':
target_dir = os.path.join(self.virtual_env, 'etc/sysconfig')
if not os.path.exists(target_dir):
os.makedirs(target_dir)
target = os.path.join(target_dir,'panda_server')
if not os.path.exists(target):
os.symlink(os.path.join(self.virtual_env, 'etc/panda/panda_server.sysconfig'),
target)



# setup for distutils
setup(
Expand Down

0 comments on commit 81c6756

Please sign in to comment.