Merge pull request #233 from aplanas/master

Sometimes __file__ points to the .pyc file.
This commit is contained in:
Stephan Kulow 2014-09-09 14:00:46 +02:00
commit 02ca8a754e
3 changed files with 7 additions and 7 deletions

View File

@ -31,7 +31,7 @@ from osc import cmdln
# Expand sys.path to search modules inside the pluging directory
PLUGINDIR = os.path.expanduser(os.path.dirname(os.path.realpath(__file__)))
PLUGINDIR = os.path.dirname(os.path.realpath(__file__.replace('.pyc', '.py')))
sys.path.append(PLUGINDIR)
from osclib.checkrepo import CheckRepo
from osclib.cycle import CycleDetector

View File

@ -23,8 +23,8 @@ from osc.core import makeurl
from osc import cmdln
# Expand sys.path to search modules inside the pluging directory
_plugin_dir = os.path.expanduser('~/.osc-plugins')
sys.path.append(_plugin_dir)
PLUGINDIR = os.path.dirname(os.path.realpath(__file__.replace('.pyc', '.py')))
sys.path.append(PLUGINDIR)
from osclib.stagingapi import StagingAPI
@ -263,8 +263,7 @@ def _checker_one_request(self, rq, opts):
self._checker_change_review_state(opts, id_, 'declined', by_group='factory-auto', message=msg)
continue
sourcechecker = os.path.dirname(os.path.realpath(os.path.expanduser('~/.osc-plugins/osc-check_source.py')))
sourcechecker = os.path.join(sourcechecker, 'source-checker.pl')
sourcechecker = os.path.join(PLUGINDIR, 'source-checker.pl')
civs = ""
new_version = None
if old_infos['version'] and old_infos['version'] != new_infos['version']:

View File

@ -92,11 +92,12 @@ class SelectCommand(object):
return self.api.move_between_project(fprj, request, self.target_project)
elif request in staged_requests and not move:
# Previously selected, but not explicit move
fprj = self.api.packages_staged[staged_requests[request]]['prj']
msg = 'Request {} is already tracked in "{}".'
msg = msg.format(request, staged_requests[request])
msg = msg.format(request, fprj)
if staged_requests[request] != self.target_project:
msg += '\nUse --move modifier to move the request from "{}" to "{}"'
msg = msg.format(staged_requests[request], self.target_project)
msg = msg.format(fprj, self.target_project)
print(msg)
return True
else: