* destdir() -> dest_dir()

* fix dest_dir:
  - default value of destdir option is None
  - set it correctly to the value read from configfile if None
This commit is contained in:
Eray Özkural
2005-10-09 17:27:07 +00:00
parent 99f4418fe2
commit 1723245daf
6 changed files with 27 additions and 20 deletions
+8 -4
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-3.8.dtd"> <!DOCTYPE Project SYSTEM "Project-3.8.dtd">
<!-- Project file for project pisi --> <!-- Project file for project pisi -->
<!-- Saved: 2005-10-05, 12:46:47 --> <!-- Saved: 2005-10-09, 20:14:24 -->
<!-- Copyright (C) 2005 PiSi Development Team, --> <!-- Copyright (C) 2005 PiSi Development Team, -->
<Project version="3.8"> <Project version="3.8">
<ProgLanguage mixed="0">Python</ProgLanguage> <ProgLanguage mixed="0">Python</ProgLanguage>
@@ -9,7 +9,7 @@
<Description>The package management software of Pardus distribution. <Description>The package management software of Pardus distribution.
</Description> </Description>
<Author>PiSi Development Team</Author> <Author>PiSi Development Team</Author>
<Emaýl></Emaýl> <Email></Email>
<Sources> <Sources>
<Source> <Source>
<Dir>tools</Dir> <Dir>tools</Dir>
@@ -344,6 +344,10 @@
<Dir>po</Dir> <Dir>po</Dir>
<Name>tr.po</Name> <Name>tr.po</Name>
</Source> </Source>
<Source>
<Dir>tools</Dir>
<Name>ChangeLogGenerator.py</Name>
</Source>
</Sources> </Sources>
<Forms> <Forms>
</Forms> </Forms>
@@ -382,9 +386,9 @@
</Vcs> </Vcs>
<FiletypeAssociations> <FiletypeAssociations>
<FiletypeAssociation pattern="*.ui.h" type="FORMS" /> <FiletypeAssociation pattern="*.ui.h" type="FORMS" />
<FiletypeAssociation pattern="*.ptl" type="SOURCES" />
<FiletypeAssociation pattern="*.idl" type="INTERFACES" />
<FiletypeAssociation pattern="*.ui" type="FORMS" /> <FiletypeAssociation pattern="*.ui" type="FORMS" />
<FiletypeAssociation pattern="*.idl" type="INTERFACES" />
<FiletypeAssociation pattern="*.ptl" type="SOURCES" />
<FiletypeAssociation pattern="*.py" type="SOURCES" /> <FiletypeAssociation pattern="*.py" type="SOURCES" />
</FiletypeAssociations> </FiletypeAssociations>
</Project> </Project>
+1 -1
View File
@@ -104,7 +104,7 @@ class BuildContext(object):
packageDir = self.spec.source.name + '-' + \ packageDir = self.spec.source.name + '-' + \
self.spec.source.version + '-' + self.spec.source.release self.spec.source.version + '-' + self.spec.source.release
from pisi.util import join_path as join from pisi.util import join_path as join
return join( ctx.config.destdir(), ctx.config.values.dirs.tmp_dir, return join( ctx.config.dest_dir(), ctx.config.values.dirs.tmp_dir,
packageDir ) packageDir )
def pkg_work_dir(self): def pkg_work_dir(self):
+4 -2
View File
@@ -19,6 +19,7 @@ _ = __trans.ugettext
import pisi import pisi
import pisi.cli import pisi.cli
from pisi.cli import printu
import pisi.context as ctx import pisi.context as ctx
from pisi.uri import URI from pisi.uri import URI
@@ -69,7 +70,8 @@ class Command(object):
def commonopts(self): def commonopts(self):
'''common options''' '''common options'''
p = self.parser p = self.parser
p.add_option("-D", "--destdir", action="store") p.add_option("-D", "--destdir", action="store", default = None,
help = _("change the system root for pisi commands"))
p.add_option("", "--yes-all", action="store_true", p.add_option("", "--yes-all", action="store_true",
default=False, help = _("assume yes in all yes/no queries")) default=False, help = _("assume yes in all yes/no queries"))
p.add_option("-u", "--username", action="store") p.add_option("-u", "--username", action="store")
@@ -186,7 +188,7 @@ If run without parameters, it prints the general help.""")
def run(self): def run(self):
if not self.args: if not self.args:
self.parser.set_usage(usage_text) self.parser.set_usage(usage_text)
ctx.ui.info(self.parser.format_help()) printu(self.parser.format_help())
return return
self.init() self.init()
+12 -11
View File
@@ -44,29 +44,30 @@ class Config(object):
# x_dir: system wide directory for storing info type x # x_dir: system wide directory for storing info type x
# pkg_x_dir: per package directory for storing info type x # pkg_x_dir: per package directory for storing info type x
def destdir(self): def dest_dir(self):
dir = str(self.get_option('destdir')) dir = self.get_option('destdir')
if not dir: if dir:
dir = self.values.general.destinationdirectory return str(dir)
return dir else:
return self.values.general.destinationdirectory
def lib_dir(self): def lib_dir(self):
return join(self.destdir(), self.values.dirs.lib_dir) return join(self.dest_dir(), self.values.dirs.lib_dir)
def db_dir(self): def db_dir(self):
return join(self.destdir(), self.values.dirs.db_dir) return join(self.dest_dir(), self.values.dirs.db_dir)
def archives_dir(self): def archives_dir(self):
return join(self.destdir(), self.values.dirs.archives_dir) return join(self.dest_dir(), self.values.dirs.archives_dir)
def packages_dir(self): def packages_dir(self):
return join(self.destdir(), self.values.dirs.packages_dir) return join(self.dest_dir(), self.values.dirs.packages_dir)
def index_dir(self): def index_dir(self):
return join(self.destdir(), self.values.dirs.index_dir) return join(self.dest_dir(), self.values.dirs.index_dir)
def tmp_dir(self): def tmp_dir(self):
return join(self.destdir(), self.values.dirs.tmp_dir) return join(self.dest_dir(), self.values.dirs.tmp_dir)
# bu dizini neden kullanıyoruz? Yalnızca index.py içerisinde # bu dizini neden kullanıyoruz? Yalnızca index.py içerisinde
# kullanılıyor ama /var/tmp/pisi/install gibi bir dizine niye # kullanılıyor ama /var/tmp/pisi/install gibi bir dizine niye
+1 -1
View File
@@ -153,7 +153,7 @@ class Installer:
"unzip package in place" "unzip package in place"
ctx.ui.info(_('Extracting files')) ctx.ui.info(_('Extracting files'))
self.package.extract_dir_flat('install', ctx.config.destdir()) self.package.extract_dir_flat('install', ctx.config.dest_dir())
if self.reinstall: if self.reinstall:
# remove left over files # remove left over files
+1 -1
View File
@@ -29,7 +29,7 @@ import pisi.comariface as comariface
# remove stuff # remove stuff
def remove_file(fileinfo): def remove_file(fileinfo):
fpath = pisi.util.join_path(ctx.config.destdir(), fileinfo.path) fpath = pisi.util.join_path(ctx.config.dest_dir(), fileinfo.path)
# TODO: We have to store configuration files for futher # TODO: We have to store configuration files for futher
# usage. Currently we'are doing it like rpm does, saving # usage. Currently we'are doing it like rpm does, saving
# with a prefix and leaving the user to edit it. In the future # with a prefix and leaving the user to edit it. In the future