2006-05-10 16:21:51 +02:00
#!/usr/bin/env python
from distutils . core import setup
2009-05-06 13:47:53 +02:00
import distutils . command . build
import distutils . command . install_data
import os . path
2009-05-06 11:33:18 +02:00
import osc . core
2009-05-14 17:49:54 +02:00
import sys
2009-05-06 13:47:53 +02:00
from osc import commandline
from osc import babysitter
2009-05-14 17:49:54 +02:00
# optional support for py2exe
try :
import py2exe
HAVE_PY2EXE = True
except :
HAVE_PY2EXE = False
2009-05-06 13:47:53 +02:00
class build_osc ( distutils . command . build . build , object ) :
"""
Custom build command which generates man page .
"""
def build_man_page ( self ) :
"""
"""
2009-05-09 16:16:18 +02:00
import gzip
man_path = os . path . join ( ' build ' , ' osc.1.gz ' )
2009-05-06 13:47:53 +02:00
distutils . log . info ( ' generating %s ' % man_path )
2009-05-09 16:16:18 +02:00
outfile = gzip . open ( man_path , ' w ' )
2009-05-06 13:47:53 +02:00
osccli = commandline . Osc ( stdout = outfile )
2009-05-10 12:42:36 +02:00
# FIXME: we cannot call the main method because osc expects an ~/.oscrc file
# (this would break builds in environments like the obs)
#osccli.main(argv = ['osc','man'])
osccli . optparser = osccli . get_optparser ( )
2010-07-26 16:46:21 +02:00
osccli . do_man ( )
2009-05-09 16:16:18 +02:00
outfile . close ( )
2009-05-06 13:47:53 +02:00
def run ( self ) :
super ( build_osc , self ) . run ( )
2009-05-10 12:42:36 +02:00
self . build_man_page ( )
2006-05-10 16:21:51 +02:00
2009-05-14 17:49:54 +02:00
addparams = { }
if HAVE_PY2EXE :
2009-05-15 13:40:50 +02:00
addparams [ ' console ' ] = [ { ' script ' : ' osc-wrapper.py ' , ' dest_base ' : ' osc ' , ' icon_resources ' : [ ( 1 , ' osc.ico ' ) ] } ]
2009-05-14 17:49:54 +02:00
addparams [ ' zipfile ' ] = ' shared.lib '
2009-05-15 13:40:50 +02:00
addparams [ ' options ' ] = { ' py2exe ' : { ' optimize ' : 0 , ' compressed ' : True , ' packages ' : [ ' xml.etree ' , ' StringIO ' , ' gzip ' ] } }
2009-05-14 17:49:54 +02:00
data_files = [ ]
2009-05-15 13:40:50 +02:00
if sys . platform [ : 3 ] != ' win ' :
2009-05-14 17:49:54 +02:00
data_files . append ( ( os . path . join ( ' share ' , ' man ' , ' man1 ' ) , [ os . path . join ( ' build ' , ' osc.1.gz ' ) ] ) )
2006-05-10 16:21:51 +02:00
setup ( name = ' osc ' ,
2009-05-14 17:49:54 +02:00
version = osc . core . __version__ ,
description = ' openSUSE commander ' ,
long_description = ' Command-line client for the openSUSE Build Service, which allows to access repositories in the openSUSE Build Service in similar way as Subversion repositories. ' ,
author = ' openSUSE project ' ,
author_email = ' opensuse-buildservice@opensuse.org ' ,
license = ' GPL ' ,
platforms = [ ' Linux ' , ' Mac OSX ' , ' Windows XP/2000/NT ' , ' Windows 95/98/ME ' ] ,
2009-05-06 11:33:18 +02:00
keywords = [ ' openSUSE ' , ' SUSE ' , ' RPM ' , ' build ' , ' buildservice ' ] ,
2010-07-27 15:20:35 +02:00
url = ' http://en.opensuse.org/openSUSE:OSC ' ,
2010-02-06 23:45:24 +01:00
download_url = ' http://gitorious.org/opensuse/osc ' ,
2006-05-10 16:21:51 +02:00
2009-05-14 17:49:54 +02:00
packages = [ ' osc ' , ' osc.util ' ] ,
scripts = [ ' osc_hotshot.py ' , ' osc-wrapper.py ' ] ,
data_files = data_files ,
2006-05-10 16:21:51 +02:00
2009-05-06 13:47:53 +02:00
# Override certain command classes with our own ones
cmdclass = {
' build ' : build_osc ,
} ,
2009-05-14 17:49:54 +02:00
* * addparams
2006-05-10 16:21:51 +02:00
)