Skip to content

Commit

Permalink
Quick fix for kaazoo#7
Browse files Browse the repository at this point in the history
TODO: move the command into seperate .py file (IMHO)
  • Loading branch information
jedie committed Jul 24, 2015
1 parent c65a872 commit df03816
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import os, glob, shutil, sys, pwd, grp
import os, glob, shutil, sys
from setuptools import setup
from distutils.core import setup, Command


try:
import pwd, grp
except ImportError:
# e.g. under windows
pwd = grp = None


def read(fname):
"""Read file contents."""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
Expand Down Expand Up @@ -97,10 +104,10 @@ def run(self):
shutil.copy(template, drqueue_etc)

# set to user-supplied user / group
if self.owner != None:
if self.owner != None and pwd is not None:
uid = pwd.getpwnam(self.owner)[2]
recursive_chown(drqueue_root, uid, -1)
if self.group != None:
if self.group != None and grp is not None:
gid = grp.getgrnam(self.group)[2]
recursive_chown(drqueue_root, -1, gid)

Expand Down

0 comments on commit df03816

Please sign in to comment.