简体   繁体   English

python setup.py目录权限

[英]python setup.py directory permissions

I am trying to create a setup.py that will build rpm/deb packages and I want it to create a blank directory with 777 permissions. 我试图创建一个setup.py来构建rpm / deb软件包,我希望它创建一个具有777权限的空白目录。 I have it creating the directory via data_files 我有它通过data_files创建目录

  data_files=[ 
                ( '/var/spool/my_dir', [] )
             }

But it creates the directory with 755 permissions. 但是它将创建具有755权限的目录。 How do i get setup.py to create this directory with 777 permissions?? 如何获取setup.py以创建具有777权限的目录?

There is a way to do this. 有一种方法可以做到这一点。 You will need to override the install method. 您将需要覆盖install方法。 See my answer here: set file permissions in setup.py file 在这里查看我的答案: 在setup.py文件中设置文件权限

I don't think there's a way to specify file permissions in the call to setup . 我认为没有办法在setup调用中指定文件权限。

You could always import os and do something like os.chmod('/var/spool/my_dir', 0777) after the setup call. setup调用之后,您始终可以import os并执行os.chmod('/var/spool/my_dir', 0777)之类的操作。 To be honest though, I wonder if you really need those permissions. 老实说,我想知道您是否真的需要那些权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM