Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

[PATCH] Fix permissions of data files

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


njriley at uiuc

Jul 22, 2004, 10:36 PM

Post #1 of 2 (306 views)
Permalink
[PATCH] Fix permissions of data files

Because I have my umask set to 077, distutils installs the ClearSilver
templates, CSS, HTML, etc. with no group/world permissions, so I get
weird errors until I manually set them. The attached patch fixes
this. (Beats me why distutils doesn't do this by default, like the
standard 'install' program does).

--
=Nicholas Riley <njriley [at] uiuc> | <http://www.uiuc.edu/ph/www/njriley>
-------------- next part --------------
Index: setup.py
===================================================================
--- setup.py (revision 487)
+++ setup.py (working copy)
@@ -6,8 +6,9 @@
from glob import glob
from distutils.core import setup
from distutils.command.install import install
+from distutils.command.install_data import install_data
from distutils.command.install_scripts import install_scripts
-from stat import ST_MODE
+from stat import ST_MODE, S_ISDIR

import trac

@@ -102,7 +103,21 @@
os.chmod(file, mode)


+class my_install_data (install_data):
+ def run (self):
+ install_data.run(self)

+ if os.name == 'posix' and not self.dry_run:
+ # Make the data files we just installed world-readable,
+ # and the directories world-executable as well.
+ for path in self.get_outputs():
+ mode = os.stat(path)[ST_MODE]
+ if S_ISDIR(mode):
+ mode |= 011
+ mode |= 044
+ os.chmod(path, mode)
+
+
# Our custom bdist_wininst
import distutils.command.bdist_wininst
from distutils.command.bdist_wininst import bdist_wininst
@@ -138,7 +153,8 @@
_p('scripts/tracdb2env'),
_p('cgi-bin/trac.cgi')],
cmdclass = {'install': my_install,
- 'install_scripts': my_install_scripts})
+ 'install_scripts': my_install_scripts,
+ 'install_data': my_install_data})


jonas at edgewall

Jul 22, 2004, 10:36 PM

Post #2 of 2 (288 views)
Permalink
[PATCH] Fix permissions of data files [In reply to]

Nicholas Riley wrote:

> Because I have my umask set to 077, distutils installs the ClearSilver
> templates, CSS, HTML, etc. with no group/world permissions, so I get
> weird errors until I manually set them. The attached patch fixes
> this. (Beats me why distutils doesn't do this by default, like the
> standard 'install' program does).
>
>
Applied, thanks!

/ Jonas
--
Jonas Borgstr?m | Edgewall Software
jonas [at] edgewall | Professional GNU/Linux & Open Source Consulting.
| http://www.edgewall.com/

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.