pypt-offline-general Mailing List for Offline Package Manager
Status: Beta
Brought to you by:
riteshsarraf
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(9) |
Sep
(1) |
Oct
(5) |
Nov
(7) |
Dec
(10) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(12) |
Feb
(11) |
Mar
(10) |
Apr
(2) |
May
(10) |
Jun
(3) |
Jul
(12) |
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(2) |
2009 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rit...@us...> - 2009-01-20 10:27:24
|
Revision: 203 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=203&view=rev Author: riteshsarraf Date: 2009-01-20 10:27:14 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Remove the test file Removed Paths: ------------- trunk/local-svn.test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2009-01-20 10:26:53
|
Revision: 202 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=202&view=rev Author: riteshsarraf Date: 2009-01-20 10:26:48 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Merge branch 'local-git/master' into local-svn/trunk Removed Paths: ------------- trunk/local-git.master This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2009-01-16 13:23:07
|
Revision: 200 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=200&view=rev Author: riteshsarraf Date: 2009-01-16 12:12:30 +0000 (Fri, 16 Jan 2009) Log Message: ----------- Just a test for the local-svn/trunk branch Added Paths: ----------- trunk/local-svn.test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-12-28 18:46:24
|
Revision: 199 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=199&view=rev Author: riteshsarraf Date: 2007-12-28 10:46:29 -0800 (Fri, 28 Dec 2007) Log Message: ----------- Add initial GUI support to pypt-offline Modified Paths: -------------- trunk/pypt_core.py Added Paths: ----------- trunk/pyptofflinegui.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-12-27 20:01:00 UTC (rev 198) +++ trunk/pypt_core.py 2007-12-28 18:46:29 UTC (rev 199) @@ -1489,6 +1489,8 @@ parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true") parser.add_option("", "--socket-timeout", dest="socket_timeout", help="Set the socket timeout value. Default is 30s.", action="store", type="int", metavar="30", default=30) + parser.add_option("", "--gui", dest="gui", help="Run in Graphical Mode", + action="store_true") #INFO: Option zip is not enabled by default but is highly encouraged. parser.add_option("-z","--zip", dest="zip_it", help="Zip the downloaded files to a single zip file", action="store_true") @@ -1536,6 +1538,23 @@ (options, args) = parser.parse_args() try: + if options.gui: + try: + from qt import * + except ImportError: + sys.exit(1) + + try: + from pyptofflinegui import pyptofflineguiForm + except ImportError: + sys.exit(1) + + app = QApplication(sys.argv) + QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()") ) + w = pyptofflineguiForm() + app.setMainWidget(w) + w.show() + app.exec_loop() # The log implementation # Instantiate the class global log Added: trunk/pyptofflinegui.py =================================================================== --- trunk/pyptofflinegui.py (rev 0) +++ trunk/pyptofflinegui.py 2007-12-28 18:46:29 UTC (rev 199) @@ -0,0 +1,358 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'pyptofflinegui.ui' +# +# Created: Fri Dec 28 18:18:28 2007 +# by: The PyQt User Interface Compiler (pyuic) 3.17.3 +# +# WARNING! All changes made in this file will be lost! + + +from qt import * + + +class pyptofflineguiForm(QMainWindow): + def __init__(self,parent = None,name = None,fl = 0): + QMainWindow.__init__(self,parent,name,fl) + self.statusBar() + + if not name: + self.setName("pyptofflineguiForm") + + self.setUsesTextLabel(1) + + self.setCentralWidget(QWidget(self,"qt_central_widget")) + + self.pyptTabWidget = QTabWidget(self.centralWidget(),"pyptTabWidget") + self.pyptTabWidget.setGeometry(QRect(10,0,600,430)) + + self.tab = QWidget(self.pyptTabWidget,"tab") + + self.textLabel1 = QLabel(self.tab,"textLabel1") + self.textLabel1.setGeometry(QRect(110,81,361,80)) + textLabel1_font = QFont(self.textLabel1.font()) + textLabel1_font.setPointSize(48) + self.textLabel1.setFont(textLabel1_font) + + self.textLabel1_2 = QLabel(self.tab,"textLabel1_2") + self.textLabel1_2.setGeometry(QRect(150,190,280,24)) + + self.textLabel2 = QLabel(self.tab,"textLabel2") + self.textLabel2.setGeometry(QRect(140,220,291,21)) + self.pyptTabWidget.insertTab(self.tab,QString.fromLatin1("")) + + self.tab_2 = QWidget(self.pyptTabWidget,"tab_2") + + LayoutWidget = QWidget(self.tab_2,"layout20") + LayoutWidget.setGeometry(QRect(10,20,380,210)) + layout20 = QGridLayout(LayoutWidget,1,1,11,6,"layout20") + + self.setInstallPackageTextLabel = QLabel(LayoutWidget,"setInstallPackageTextLabel") + + layout20.addWidget(self.setInstallPackageTextLabel,2,0) + + self.setUpgradeTypeComboBox = QComboBox(0,LayoutWidget,"setUpgradeTypeComboBox") + + layout20.addWidget(self.setUpgradeTypeComboBox,1,1) + + self.setFilePathLineEdit = QLineEdit(LayoutWidget,"setFilePathLineEdit") + self.setFilePathLineEdit.setPaletteBackgroundColor(QColor(255,255,255)) + self.setFilePathLineEdit.setAlignment(QLineEdit.AlignAuto) + + layout20.addWidget(self.setFilePathLineEdit,3,1) + + self.pushButton6 = QPushButton(LayoutWidget,"pushButton6") + + layout20.addWidget(self.pushButton6,3,2) + + self.setUpgradeTypeTextLabel = QLabel(LayoutWidget,"setUpgradeTypeTextLabel") + + layout20.addWidget(self.setUpgradeTypeTextLabel,1,0) + + self.setInstallationTypeTextLabel = QLabel(LayoutWidget,"setInstallationTypeTextLabel") + + layout20.addWidget(self.setInstallationTypeTextLabel,0,0) + + self.setFilePathTextLabel = QLabel(LayoutWidget,"setFilePathTextLabel") + + layout20.addWidget(self.setFilePathTextLabel,3,0) + + self.setInstallationTypeComboBox = QComboBox(0,LayoutWidget,"setInstallationTypeComboBox") + + layout20.addWidget(self.setInstallationTypeComboBox,0,1) + + self.setInstallPackagesLineEdit = QLineEdit(LayoutWidget,"setInstallPackagesLineEdit") + self.setInstallPackagesLineEdit.setPaletteBackgroundColor(QColor(255,255,255)) + setInstallPackagesLineEdit_font = QFont(self.setInstallPackagesLineEdit.font()) + setInstallPackagesLineEdit_font.setBold(1) + self.setInstallPackagesLineEdit.setFont(setInstallPackagesLineEdit_font) + self.setInstallPackagesLineEdit.setAlignment(QLineEdit.AlignAuto) + + layout20.addWidget(self.setInstallPackagesLineEdit,2,1) + + self.pushButton5 = QPushButton(self.tab_2,"pushButton5") + self.pushButton5.setGeometry(QRect(450,350,100,20)) + + self.textBrowser3 = QTextBrowser(self.tab_2,"textBrowser3") + self.textBrowser3.setGeometry(QRect(8,249,381,140)) + + self.textLabel3 = QLabel(self.tab_2,"textLabel3") + self.textLabel3.setGeometry(QRect(8,228,191,21)) + self.pyptTabWidget.insertTab(self.tab_2,QString.fromLatin1("")) + + self.TabPage = QWidget(self.pyptTabWidget,"TabPage") + + LayoutWidget_2 = QWidget(self.TabPage,"layout22") + LayoutWidget_2.setGeometry(QRect(18,30,340,130)) + layout22 = QGridLayout(LayoutWidget_2,1,1,11,6,"layout22") + + self.fetchUpdateDataRadioButton = QRadioButton(LayoutWidget_2,"fetchUpdateDataRadioButton") + + layout22.addWidget(self.fetchUpdateDataRadioButton,0,0) + + self.fetchUpgradeDataRadioButton = QRadioButton(LayoutWidget_2,"fetchUpgradeDataRadioButton") + + layout22.addWidget(self.fetchUpgradeDataRadioButton,1,0) + + self.fetchBrowseLineEdit = QLineEdit(LayoutWidget_2,"fetchBrowseLineEdit") + self.fetchBrowseLineEdit.setPaletteBackgroundColor(QColor(255,255,255)) + + layout22.addWidget(self.fetchBrowseLineEdit,2,0) + + self.fetchBrowsePushButton = QPushButton(LayoutWidget_2,"fetchBrowsePushButton") + + layout22.addWidget(self.fetchBrowsePushButton,2,1) + + self.fetchProgressBar = QProgressBar(self.TabPage,"fetchProgressBar") + self.fetchProgressBar.setGeometry(QRect(20,350,340,20)) + + self.fetchOptionsButtonGroup = QButtonGroup(self.TabPage,"fetchOptionsButtonGroup") + self.fetchOptionsButtonGroup.setGeometry(QRect(380,20,190,290)) + + self.fetchZipCheckBox = QCheckBox(self.fetchOptionsButtonGroup,"fetchZipCheckBox") + self.fetchZipCheckBox.setGeometry(QRect(8,23,91,20)) + self.fetchZipCheckBox.setChecked(1) + + self.fetchTargetDownloadFolderPushButton = QPushButton(self.fetchOptionsButtonGroup,"fetchTargetDownloadFolderPushButton") + self.fetchTargetDownloadFolderPushButton.setGeometry(QRect(150,94,30,21)) + + self.fetchZipPushButton = QPushButton(self.fetchOptionsButtonGroup,"fetchZipPushButton") + self.fetchZipPushButton.setGeometry(QRect(150,44,30,20)) + + self.fetchCacheDirectoryPushButton = QPushButton(self.fetchOptionsButtonGroup,"fetchCacheDirectoryPushButton") + self.fetchCacheDirectoryPushButton.setGeometry(QRect(151,140,30,21)) + + self.fetchCacheDirectoryCheckBox = QCheckBox(self.fetchOptionsButtonGroup,"fetchCacheDirectoryCheckBox") + self.fetchCacheDirectoryCheckBox.setGeometry(QRect(8,119,170,21)) + + self.fetchTargetDownloadFolderCheckbox = QCheckBox(self.fetchOptionsButtonGroup,"fetchTargetDownloadFolderCheckbox") + self.fetchTargetDownloadFolderCheckbox.setGeometry(QRect(8,71,170,21)) + + self.fetchCacheDirectoryLineEdit = QLineEdit(self.fetchOptionsButtonGroup,"fetchCacheDirectoryLineEdit") + self.fetchCacheDirectoryLineEdit.setGeometry(QRect(10,140,140,21)) + self.fetchCacheDirectoryLineEdit.setPaletteBackgroundColor(QColor(255,255,255)) + + self.fetchTargetDownloadFolderLineEdit = QLineEdit(self.fetchOptionsButtonGroup,"fetchTargetDownloadFolderLineEdit") + self.fetchTargetDownloadFolderLineEdit.setGeometry(QRect(8,94,140,21)) + self.fetchTargetDownloadFolderLineEdit.setPaletteBackgroundColor(QColor(255,255,255)) + + self.lineEdit7 = QLineEdit(self.fetchOptionsButtonGroup,"lineEdit7") + self.lineEdit7.setGeometry(QRect(8,44,141,21)) + self.lineEdit7.setPaletteBackgroundColor(QColor(255,255,255)) + + self.fetchThreadsSpinBox = QSpinBox(self.fetchOptionsButtonGroup,"fetchThreadsSpinBox") + self.fetchThreadsSpinBox.setGeometry(QRect(10,260,131,21)) + self.fetchThreadsSpinBox.setMaxValue(5) + self.fetchThreadsSpinBox.setMinValue(1) + + self.fetchThreadsTextLabel = QLabel(self.fetchOptionsButtonGroup,"fetchThreadsTextLabel") + self.fetchThreadsTextLabel.setGeometry(QRect(10,240,121,21)) + + self.fetchDisableMD5ChecksumCheckBox = QCheckBox(self.fetchOptionsButtonGroup,"fetchDisableMD5ChecksumCheckBox") + self.fetchDisableMD5ChecksumCheckBox.setGeometry(QRect(10,190,170,21)) + + self.checkBox5 = QCheckBox(self.fetchOptionsButtonGroup,"checkBox5") + self.checkBox5.setGeometry(QRect(10,210,170,21)) + self.checkBox5.setChecked(1) + + self.fetchStartButton = QPushButton(self.TabPage,"fetchStartButton") + self.fetchStartButton.setGeometry(QRect(450,350,100,20)) + + self.fetchTextBrowser = QTextBrowser(self.TabPage,"fetchTextBrowser") + self.fetchTextBrowser.setGeometry(QRect(20,181,340,160)) + + self.fetchConsoleOutputTextLabel = QLabel(self.TabPage,"fetchConsoleOutputTextLabel") + self.fetchConsoleOutputTextLabel.setGeometry(QRect(20,160,141,20)) + self.pyptTabWidget.insertTab(self.TabPage,QString.fromLatin1("")) + + self.TabPage_2 = QWidget(self.pyptTabWidget,"TabPage_2") + + LayoutWidget_3 = QWidget(self.TabPage_2,"layout24") + LayoutWidget_3.setGeometry(QRect(30,20,330,130)) + layout24 = QGridLayout(LayoutWidget_3,1,1,11,6,"layout24") + + self.installUpdateDataRadioButton = QRadioButton(LayoutWidget_3,"installUpdateDataRadioButton") + + layout24.addWidget(self.installUpdateDataRadioButton,0,0) + + self.installUpgradeDataRadioButton = QRadioButton(LayoutWidget_3,"installUpgradeDataRadioButton") + + layout24.addWidget(self.installUpgradeDataRadioButton,1,0) + + self.instalBrowsePushButton = QPushButton(LayoutWidget_3,"instalBrowsePushButton") + + layout24.addWidget(self.instalBrowsePushButton,2,1) + + self.installLineEdit = QLineEdit(LayoutWidget_3,"installLineEdit") + + layout24.addWidget(self.installLineEdit,2,0) + + self.textLabel7 = QLabel(self.TabPage_2,"textLabel7") + self.textLabel7.setGeometry(QRect(30,150,171,31)) + + self.installTextBrowser = QTextBrowser(self.TabPage_2,"installTextBrowser") + self.installTextBrowser.setGeometry(QRect(28,184,331,201)) + + self.installStartPushButton = QPushButton(self.TabPage_2,"installStartPushButton") + self.installStartPushButton.setGeometry(QRect(450,350,100,20)) + self.pyptTabWidget.insertTab(self.TabPage_2,QString.fromLatin1("")) + + self.fileExitAction = QAction(self,"fileExitAction") + self.helpAboutAction = QAction(self,"helpAboutAction") + + + + + self.MenuBar = QMenuBar(self,"MenuBar") + + + self.fileMenu = QPopupMenu(self) + self.fileMenu.insertSeparator() + self.fileMenu.insertSeparator() + self.fileExitAction.addTo(self.fileMenu) + self.MenuBar.insertItem(QString(""),self.fileMenu,1) + + self.helpMenu = QPopupMenu(self) + self.helpAboutAction.addTo(self.helpMenu) + self.helpMenu.insertSeparator() + self.MenuBar.insertItem(QString(""),self.helpMenu,2) + + + self.languageChange() + + self.resize(QSize(618,480).expandedTo(self.minimumSizeHint())) + self.clearWState(Qt.WState_Polished) + + self.connect(self.fileExitAction,SIGNAL("activated()"),self.close) + self.connect(self.helpAboutAction,SIGNAL("activated()"),self.helpAbout) + + self.setInstallPackageTextLabel.setBuddy(self.setInstallPackagesLineEdit) + self.setUpgradeTypeTextLabel.setBuddy(self.setUpgradeTypeComboBox) + self.setFilePathTextLabel.setBuddy(self.setFilePathLineEdit) + + + def languageChange(self): + self.setCaption(self.__tr("pypt-offline | Offline Package Manager | (C) Ritesh Raj Sarraf - RESEARCHUT")) + self.textLabel1.setText(self.__tr("<p align=\"center\">pypt-offline</p>")) + self.textLabel1_2.setText(self.__tr("<p align=\"center\"><font><font size=\"+1\">Offline Package Manager</font></font></p>")) + self.textLabel2.setText(self.__tr("<p align=\"center\"><font size=\"+1\">(C) Ritesh Raj Sarraf - RESEARCHUT</font></p>")) + self.pyptTabWidget.changeTab(self.tab,self.__tr("Welcome")) + self.setInstallPackageTextLabel.setText(self.__tr("Install Packages")) + self.setUpgradeTypeComboBox.clear() + self.setUpgradeTypeComboBox.insertItem(QString.null) + self.setUpgradeTypeComboBox.insertItem(self.__tr("upgrade")) + self.setUpgradeTypeComboBox.insertItem(self.__tr("dist-upgrade")) + self.setUpgradeTypeComboBox.insertItem(self.__tr("dselect-upgrade")) + QToolTip.add(self.setUpgradeTypeComboBox,self.__tr("Select the type of upgrade you want to perform")) + QToolTip.add(self.setFilePathLineEdit,self.__tr("Full path to a file you want to write to")) + self.pushButton6.setText(self.__tr("Browse")) + self.setUpgradeTypeTextLabel.setText(self.__tr("Upgrade Type")) + self.setInstallationTypeTextLabel.setText(self.__tr("Installation Type")) + self.setFilePathTextLabel.setText(self.__tr("File Path")) + self.setInstallationTypeComboBox.clear() + self.setInstallationTypeComboBox.insertItem(QString.null) + self.setInstallationTypeComboBox.insertItem(self.__tr("Update")) + self.setInstallationTypeComboBox.insertItem(self.__tr("Upgrade")) + self.setInstallationTypeComboBox.insertItem(self.__tr("Install")) + QToolTip.add(self.setInstallationTypeComboBox,self.__tr("Select the type of installation you want to perform")) + QToolTip.add(self.setInstallPackagesLineEdit,self.__tr("Package names separated by space")) + self.pushButton5.setText(self.__tr("Start")) + self.pushButton5.setAccel(QKeySequence(QString.null)) + self.textLabel3.setText(self.__tr("textLabel3")) + self.pyptTabWidget.changeTab(self.tab_2,self.__tr("Set")) + self.fetchUpdateDataRadioButton.setText(self.__tr("Update Data")) + QToolTip.add(self.fetchUpdateDataRadioButton,self.__tr("Select this if you want to fetch the package database updates")) + self.fetchUpgradeDataRadioButton.setText(self.__tr("Upgrade Data")) + QToolTip.add(self.fetchUpgradeDataRadioButton,self.__tr("Select this if you want to fetch the packages which need to be upgraded/installed")) + QToolTip.add(self.fetchBrowseLineEdit,self.__tr("Path to the data file that was generated on the disconnected machine")) + self.fetchBrowsePushButton.setText(self.__tr("Browse")) + QToolTip.add(self.fetchProgressBar,self.__tr("Not Implemented Yet")) + self.fetchOptionsButtonGroup.setTitle(self.__tr("Options")) + self.fetchZipCheckBox.setText(self.__tr("Zip")) + self.fetchTargetDownloadFolderPushButton.setText(self.__tr("...")) + self.fetchZipPushButton.setText(self.__tr("...")) + self.fetchCacheDirectoryPushButton.setText(self.__tr("...")) + self.fetchCacheDirectoryCheckBox.setText(self.__tr("Cache Directory")) + self.fetchTargetDownloadFolderCheckbox.setText(self.__tr("Target Download Folder")) + QToolTip.add(self.fetchCacheDirectoryLineEdit,self.__tr("Check this and specify the cache directory which contains pre-downloaded packages")) + QToolTip.add(self.fetchTargetDownloadFolderLineEdit,self.__tr("Check this and specify the target download folder where the downloaded data will be saved")) + QToolTip.add(self.lineEdit7,self.__tr("Check this and specify the full path for zip archive")) + QToolTip.add(self.fetchThreadsSpinBox,self.__tr("Number of threads you want to spawn")) + self.fetchThreadsTextLabel.setText(self.__tr("Threads")) + self.fetchDisableMD5ChecksumCheckBox.setText(self.__tr("Disable MD5 Checksum")) + QToolTip.add(self.fetchDisableMD5ChecksumCheckBox,self.__tr("Check this if you want to disable MD5 Checksum")) + self.checkBox5.setText(self.__tr("Fetch Bug Reports")) + QToolTip.add(self.checkBox5,self.__tr("Check this if you want to download the bug reports")) + self.fetchStartButton.setText(self.__tr("Start")) + self.fetchConsoleOutputTextLabel.setText(self.__tr("Console Output")) + self.pyptTabWidget.changeTab(self.TabPage,self.__tr("Fetch")) + self.installUpdateDataRadioButton.setText(self.__tr("Update Data")) + QToolTip.add(self.installUpdateDataRadioButton,self.__tr("Select this to install the package database update")) + self.installUpgradeDataRadioButton.setText(self.__tr("Upgrade Data")) + QToolTip.add(self.installUpgradeDataRadioButton,self.__tr("Select this to install/upgrade the packages")) + self.instalBrowsePushButton.setText(self.__tr("Browse")) + QToolTip.add(self.installLineEdit,self.__tr("Specify the zip archive or full folder path which contains the downloaded data")) + self.textLabel7.setText(self.__tr("Console Output")) + self.installStartPushButton.setText(self.__tr("Start")) + self.pyptTabWidget.changeTab(self.TabPage_2,self.__tr("Install")) + self.fileExitAction.setText(self.__tr("Exit")) + self.fileExitAction.setMenuText(self.__tr("E&xit")) + self.fileExitAction.setAccel(QString.null) + self.helpAboutAction.setText(self.__tr("About")) + self.helpAboutAction.setMenuText(self.__tr("&About")) + self.helpAboutAction.setAccel(QString.null) + if self.MenuBar.findItem(1): + self.MenuBar.findItem(1).setText(self.__tr("&File")) + if self.MenuBar.findItem(2): + self.MenuBar.findItem(2).setText(self.__tr("&Help")) + + + def fileNew(self): + print "pyptofflineguiForm.fileNew(): Not implemented yet" + + def fileOpen(self): + print "pyptofflineguiForm.fileOpen(): Not implemented yet" + + def fileSave(self): + print "pyptofflineguiForm.fileSave(): Not implemented yet" + + def fileSaveAs(self): + print "pyptofflineguiForm.fileSaveAs(): Not implemented yet" + + def filePrint(self): + print "pyptofflineguiForm.filePrint(): Not implemented yet" + + def fileExit(self): + print "pyptofflineguiForm.fileExit(): Not implemented yet" + + def helpIndex(self): + print "pyptofflineguiForm.helpIndex(): Not implemented yet" + + def helpContents(self): + print "pyptofflineguiForm.helpContents(): Not implemented yet" + + def helpAbout(self): + print "pyptofflineguiForm.helpAbout(): Not implemented yet" + + def __tr(self,s,c = None): + return qApp.translate("pyptofflineguiForm",s,c) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-12-27 20:00:56
|
Revision: 198 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=198&view=rev Author: riteshsarraf Date: 2007-12-27 12:01:00 -0800 (Thu, 27 Dec 2007) Log Message: ----------- changeset: 356:466803e87132 branch: trunk tag: tip user: Ritesh Raj Sarraf <rr...@re...> date: Fri Dec 28 01:25:55 2007 +0530 files: Makefile build.xml pyptofflinegui.ui description: Add GUI files for pypt-offline changeset: 355:ff94448c4c76 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Fri Dec 28 01:25:20 2007 +0530 files: pypt_core.py description: Indentation fixes. Remove duplicate array import Modified Paths: -------------- trunk/pypt_core.py Added Paths: ----------- trunk/Makefile trunk/build.xml trunk/pyptofflinegui.ui Added: trunk/Makefile =================================================================== --- trunk/Makefile (rev 0) +++ trunk/Makefile 2007-12-27 20:01:00 UTC (rev 198) @@ -0,0 +1,5 @@ +all: + pyuic pyptofflinegui.ui > pyptofflinegui.py + +clean: + rm -f pyptofflinegui.py \ No newline at end of file Added: trunk/build.xml =================================================================== --- trunk/build.xml (rev 0) +++ trunk/build.xml 2007-12-27 20:01:00 UTC (rev 198) @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<project name="pypt-offline" default="make"> + <description> + Ant adaptor for the pypt-offline Makefile + </description> + + <target name="make" description="build pyptofflinegui"> + <exec executable="make"> + <arg value="-f"/> + <arg value="Makefile"/> + <arg value="all"/> + </exec> + </target> + + <target name="clean" description="clean pypt-offline" depends="make"> + <exec executable="make"> + <arg value="-f"/> + <arg value="Makefile"/> + <arg value="clean"/> + </exec> + </target> +</project> Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-26 20:16:00 UTC (rev 197) +++ trunk/pypt_core.py 2007-12-27 20:01:00 UTC (rev 198) @@ -27,7 +27,6 @@ import threading import signal import optparse -import array import socket import tempfile @@ -906,7 +905,7 @@ log.msg("Downloading %s - %d KB%s\n" % (PackageName, size/1024, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) != True: - errlist.append(PackageName) + errlist.append(PackageName) else: log.success("%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) if os.access(os.path.join(cache_dir, file), os.F_OK): Added: trunk/pyptofflinegui.ui =================================================================== --- trunk/pyptofflinegui.ui (rev 0) +++ trunk/pyptofflinegui.ui 2007-12-27 20:01:00 UTC (rev 198) @@ -0,0 +1,895 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>pyptofflineguiForm</class> +<widget class="QMainWindow"> + <property name="name"> + <cstring>pyptofflineguiForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>618</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string>pypt-offline | Offline Package Manager | (C) Ritesh Raj Sarraf - RESEARCHUT</string> + </property> + <property name="usesTextLabel"> + <bool>true</bool> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>pyptTabWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>0</y> + <width>600</width> + <height>430</height> + </rect> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Welcome</string> + </attribute> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>110</x> + <y>81</y> + <width>361</width> + <height>80</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>48</pointsize> + </font> + </property> + <property name="text"> + <string><p align="center">pypt-offline</p></string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="geometry"> + <rect> + <x>150</x> + <y>190</y> + <width>280</width> + <height>24</height> + </rect> + </property> + <property name="text"> + <string><p align="center"><font><font size="+1">Offline Package Manager</font></font></p></string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="geometry"> + <rect> + <x>140</x> + <y>220</y> + <width>291</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string><p align="center"><font size="+1">(C) Ritesh Raj Sarraf - RESEARCHUT</font></p></string> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Set</string> + </attribute> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout20</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>20</y> + <width>380</width> + <height>210</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>setInstallPackageTextLabel</cstring> + </property> + <property name="text"> + <string>Install Packages</string> + </property> + <property name="buddy" stdset="0"> + <cstring>setInstallPackagesLineEdit</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string></string> + </property> + </item> + <item> + <property name="text"> + <string>upgrade</string> + </property> + </item> + <item> + <property name="text"> + <string>dist-upgrade</string> + </property> + </item> + <item> + <property name="text"> + <string>dselect-upgrade</string> + </property> + </item> + <property name="name"> + <cstring>setUpgradeTypeComboBox</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Select the type of upgrade you want to perform</string> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>setFilePathLineEdit</cstring> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="alignment"> + <set>AlignAuto</set> + </property> + <property name="toolTip" stdset="0"> + <string>Full path to a file you want to write to</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="2"> + <property name="name"> + <cstring>pushButton6</cstring> + </property> + <property name="text"> + <string>Browse</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>setUpgradeTypeTextLabel</cstring> + </property> + <property name="text"> + <string>Upgrade Type</string> + </property> + <property name="buddy" stdset="0"> + <cstring>setUpgradeTypeComboBox</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>setInstallationTypeTextLabel</cstring> + </property> + <property name="text"> + <string>Installation Type</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comboBox3</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>setFilePathTextLabel</cstring> + </property> + <property name="text"> + <string>File Path</string> + </property> + <property name="buddy" stdset="0"> + <cstring>setFilePathLineEdit</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string></string> + </property> + </item> + <item> + <property name="text"> + <string>Update</string> + </property> + </item> + <item> + <property name="text"> + <string>Upgrade</string> + </property> + </item> + <item> + <property name="text"> + <string>Install</string> + </property> + </item> + <property name="name"> + <cstring>setInstallationTypeComboBox</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Select the type of installation you want to perform</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>setInstallPackagesLineEdit</cstring> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="alignment"> + <set>AlignAuto</set> + </property> + <property name="toolTip" stdset="0"> + <string>Package names separated by space</string> + </property> + </widget> + </grid> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButton5</cstring> + </property> + <property name="geometry"> + <rect> + <x>450</x> + <y>350</y> + <width>100</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Start</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>textBrowser3</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>249</y> + <width>381</width> + <height>140</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>228</y> + <width>191</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>textLabel3</string> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Fetch</string> + </attribute> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout22</cstring> + </property> + <property name="geometry"> + <rect> + <x>18</x> + <y>30</y> + <width>340</width> + <height>130</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>fetchUpdateDataRadioButton</cstring> + </property> + <property name="text"> + <string>Update Data</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select this if you want to fetch the package database updates</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>fetchUpgradeDataRadioButton</cstring> + </property> + <property name="text"> + <string>Upgrade Data</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select this if you want to fetch the packages which need to be upgraded/installed</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="0"> + <property name="name"> + <cstring>fetchBrowseLineEdit</cstring> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>Path to the data file that was generated on the disconnected machine</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>fetchBrowsePushButton</cstring> + </property> + <property name="text"> + <string>Browse</string> + </property> + </widget> + </grid> + </widget> + <widget class="QProgressBar"> + <property name="name"> + <cstring>fetchProgressBar</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>350</y> + <width>340</width> + <height>20</height> + </rect> + </property> + <property name="toolTip" stdset="0"> + <string>Not Implemented Yet</string> + </property> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>fetchOptionsButtonGroup</cstring> + </property> + <property name="geometry"> + <rect> + <x>380</x> + <y>20</y> + <width>190</width> + <height>290</height> + </rect> + </property> + <property name="title"> + <string>Options</string> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fetchZipCheckBox</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>23</y> + <width>91</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Zip</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>fetchTargetDownloadFolderPushButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>150</x> + <y>94</y> + <width>30</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>fetchZipPushButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>150</x> + <y>44</y> + <width>30</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>fetchCacheDirectoryPushButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>151</x> + <y>140</y> + <width>30</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fetchCacheDirectoryCheckBox</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>119</y> + <width>170</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Cache Directory</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fetchTargetDownloadFolderCheckbox</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>71</y> + <width>170</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Target Download Folder</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>fetchCacheDirectoryLineEdit</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>140</y> + <width>140</width> + <height>21</height> + </rect> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>Check this and specify the cache directory which contains pre-downloaded packages</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>fetchTargetDownloadFolderLineEdit</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>94</y> + <width>140</width> + <height>21</height> + </rect> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>Check this and specify the target download folder where the downloaded data will be saved</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>lineEdit7</cstring> + </property> + <property name="geometry"> + <rect> + <x>8</x> + <y>44</y> + <width>141</width> + <height>21</height> + </rect> + </property> + <property name="paletteBackgroundColor"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>Check this and specify the full path for zip archive</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>fetchThreadsSpinBox</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>260</y> + <width>131</width> + <height>21</height> + </rect> + </property> + <property name="maxValue"> + <number>5</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="toolTip" stdset="0"> + <string>Number of threads you want to spawn</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>fetchThreadsTextLabel</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>240</y> + <width>121</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Threads</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fetchDisableMD5ChecksumCheckBox</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>190</y> + <width>170</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Disable MD5 Checksum</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check this if you want to disable MD5 Checksum</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>checkBox5</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>210</y> + <width>170</width> + <height>21</height> + </rect> + </property> + <property name="text"> + <string>Fetch Bug Reports</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Check this if you want to download the bug reports</string> + </property> + </widget> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>fetchStartButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>450</x> + <y>350</y> + <width>100</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>fetchTextBrowser</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>181</y> + <width>340</width> + <height>160</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>fetchConsoleOutputTextLabel</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>160</y> + <width>141</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Console Output</string> + </property> + </widget> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Install</string> + </attribute> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <property name="geometry"> + <rect> + <x>30</x> + <y>20</y> + <width>330</width> + <height>130</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>installUpdateDataRadioButton</cstring> + </property> + <property name="text"> + <string>Update Data</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select this to install the package database update</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>installUpgradeDataRadioButton</cstring> + </property> + <property name="text"> + <string>Upgrade Data</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select this to install/upgrade the packages</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>instalBrowsePushButton</cstring> + </property> + <property name="text"> + <string>Browse</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="0"> + <property name="name"> + <cstring>installLineEdit</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Specify the zip archive or full folder path which contains the downloaded data</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="geometry"> + <rect> + <x>30</x> + <y>150</y> + <width>171</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>Console Output</string> + </property> + </widget> + <widget class="QTextBrowser"> + <property name="name"> + <cstring>installTextBrowser</cstring> + </property> + <property name="geometry"> + <rect> + <x>28</x> + <y>184</y> + <width>331</width> + <height>201</height> + </rect> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>installStartPushButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>450</x> + <y>350</y> + <width>100</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Start</string> + </property> + </widget> + </widget> + </widget> +</widget> +<menubar> + <property name="name"> + <cstring>MenuBar</cstring> + </property> + <item text="&File" name="fileMenu"> + <separator/> + <separator/> + <action name="fileExitAction"/> + </item> + <item text="&Help" name="helpMenu"> + <action name="helpAboutAction"/> + <separator/> + </item> +</menubar> +<toolbars> +</toolbars> +<actions> + <action> + <property name="name"> + <cstring>fileExitAction</cstring> + </property> + <property name="text"> + <string>Exit</string> + </property> + <property name="menuText"> + <string>E&xit</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> + <action> + <property name="name"> + <cstring>helpAboutAction</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + <property name="menuText"> + <string>&About</string> + </property> + <property name="accel"> + <string></string> + </property> + </action> +</actions> +<connections> + <connection> + <sender>fileExitAction</sender> + <signal>activated()</signal> + <receiver>pyptofflineguiForm</receiver> + <slot>close()</slot> + </connection> + <connection> + <sender>helpAboutAction</sender> + <signal>activated()</signal> + <receiver>pyptofflineguiForm</receiver> + <slot>helpAbout()</slot> + </connection> +</connections> +<slots> + <slot>fileNew()</slot> + <slot>fileOpen()</slot> + <slot>fileSave()</slot> + <slot>fileSaveAs()</slot> + <slot>filePrint()</slot> + <slot>fileExit()</slot> + <slot>helpIndex()</slot> + <slot>helpContents()</slot> + <slot>helpAbout()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-09-02 08:51:23
|
Revision: 195 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=195&view=rev Author: riteshsarraf Date: 2007-08-26 13:13:37 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Added Paths: ----------- trunk/.hgtags Added: trunk/.hgtags =================================================================== --- trunk/.hgtags (rev 0) +++ trunk/.hgtags 2007-08-26 20:13:37 UTC (rev 195) @@ -0,0 +1 @@ +9b45cef9800607a8e998785db5ff07613b5630e7 v0.7.0 \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-27 15:47:47
|
Revision: 196 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=196&view=rev Author: riteshsarraf Date: 2007-08-26 13:14:57 -0700 (Sun, 26 Aug 2007) Log Message: ----------- * Tagging for 0.7.0 Release Added Paths: ----------- tags/Release_0_7_0/ Copied: tags/Release_0_7_0 (from rev 195, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-27 15:47:40
|
Revision: 193 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=193&view=rev Author: riteshsarraf Date: 2007-08-25 06:50:49 -0700 (Sat, 25 Aug 2007) Log Message: ----------- Test commit Modified Paths: -------------- trunk/THANKS Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2007-08-25 12:55:02 UTC (rev 192) +++ trunk/THANKS 2007-08-25 13:50:49 UTC (rev 193) @@ -3,4 +3,5 @@ *) Duncan Booth *) Simon Forman *) Dennis Lee Bieber -*) Any others whom I've missed \ No newline at end of file +*) Any others whom I've missed +*) Hello! World This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-27 15:43:48
|
Revision: 194 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=194&view=rev Author: riteshsarraf Date: 2007-08-25 07:11:32 -0700 (Sat, 25 Aug 2007) Log Message: ----------- Another Test Modified Paths: -------------- trunk/THANKS Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2007-08-25 13:50:49 UTC (rev 193) +++ trunk/THANKS 2007-08-25 14:11:32 UTC (rev 194) @@ -4,4 +4,3 @@ *) Simon Forman *) Dennis Lee Bieber *) Any others whom I've missed -*) Hello! World This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-27 15:38:32
|
Revision: 197 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=197&view=rev Author: riteshsarraf Date: 2007-08-26 13:16:00 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - .project .pydevproject hgrc hg_push_repos .hg pypt-downloads .hgrc .hgignore + .project .pydevproject hgrc hg_push_repos .hg pypt-downloads .hgrc .hgignore .settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-27 15:36:23
|
Revision: 192 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=192&view=rev Author: riteshsarraf Date: 2007-08-25 05:55:02 -0700 (Sat, 25 Aug 2007) Log Message: ----------- Deleting unneeded folder Removed Paths: ------------- pypt-offline/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Ritesh R. S. <rr...@re...> - 2007-08-26 20:54:06
|
Hi, After quite some time, I'm happy to announce a new release of pypt-offline. Some of the quick features are: * Offline Bug Report support - Users can now also have information about wh= at=20 packages contain bug reports. [Debian Only] * Colored Output - Full colored output. [ Support on Windows is through=20 WConio] * Better support for threads * Many new options added I've now started using Mercurial along with SF's SVN which can be viewed at= =20 [1] and [2] I've also put up a video at [3] explaining how pypt-offline works. pypt-offline can be downloaded from: http://sf.net/projects/pypt-offline What is pypt-offline? pypt-offline is an Offline Package Manager for distributions based on Debia= n.=20 It can allow a user using a Debian distribution with no internet connection= =20 to be able to update/upgrade his box with the help of another box running=20 Windows/Linux/Mac A recent article from Ars [4] was informative enough to show how many=20 countries still don't have [or is very expensive] a proper internet=20 connection. I hope pypt-offline will be helpful to people who are willing to enjoy the= =20 powerful features of Debian but aren't yet able to do so because of interne= t=20 connectivity. =46eedback welcome. [1] http://pypt-offline.sf.net/hg/pypt-offline [2] http://www.researchut.com/hg/pypt-offline [3] http://pypt-offline.sourceforge.net/pypt-offline-video.html [4]=20 http://arstechnica.com/news.ars/post/20070727-the-internet-in-kazakhstan-we= lcome-to-the-land-of-3355-per-month-dsl.html Ritesh =2D-=20 Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention." |
From: <rit...@us...> - 2007-08-21 20:29:10
|
Revision: 191 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=191&view=rev Author: riteshsarraf Date: 2007-08-21 13:28:35 -0700 (Tue, 21 Aug 2007) Log Message: ----------- changeset: 175:9b45cef98006 branch: trunk tag: tip user: Ritesh Raj Sarraf <rr...@re...> date: Wed Aug 22 01:48:50 2007 +0530 files: pypt-offline.1 pypt_core.py description: * Added a socket timeout option which sets the socket timeout to a user * supplied value changeset: 174:5754621a926e branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Wed Aug 22 01:02:27 2007 +0530 files: pypt-offline.1 description: * Updated the pypt-offline.1 manpage changeset: 173:6b84e630839d branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Wed Aug 22 00:22:16 2007 +0530 files: pypt-offline.1 pypt_core.py description: * Remove the -u/--uris option. It is not used anymore * Order the parser options properly. changeset: 172:abd2471381ce branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 21 23:58:37 2007 +0530 files: pypt_core.py description: * Simplified error and verbose display changeset: 171:a823825c4f59 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 21 23:53:53 2007 +0530 files: pypt_core.py description: * Added option to choose a release when requesting for a package install Modified Paths: -------------- trunk/pypt-offline.1 trunk/pypt_core.py Modified: trunk/pypt-offline.1 =================================================================== --- trunk/pypt-offline.1 2007-08-20 13:54:32 UTC (rev 190) +++ trunk/pypt-offline.1 2007-08-21 20:28:35 UTC (rev 191) @@ -1,30 +1,149 @@ -.TH pypt-offline 1 "December 10, 2006" "version 0.6.2" "USER COMMANDS" +.TH pypt-offline 1 "August 20, 2007" "version 0.7.0" "USER COMMANDS" .SH NAME pypt-offline \- Offline Package manager .SH SYNOPSIS .B pypt-offline [OPTIONS] [ARGUMENTS] .SH DESCRIPTION -pypt-offline is an Offline Package Manager for Debian based systems. It bring offline package management functionality. It can download the required packages for a disconnected machine from a connected machine running Windows or Linux or Mac OS X. +pypt-offline is an Offline Package Manager for Debian based systems. It bring offline package management functionality. +It can download the required packages for a disconnected machine from a different connected machine running Windows or Linux or Mac OS X. .PP +It can also fetch bug reports for packages which are downloaded. +.PP Currently it supports only apt based systems but plans are there to support RPM based distros also. .SH OPTIONS .TP +\-\-set\-update filename +Specify the file to which the details about the update files with be written to +.TP +\-\-set\-upgrade filename +Specify the file to which the details about the package files will be written to +.TP +\-\-upgrade\-type upgrade-type +Specify the type of upgrade you want to do. Possible values are upgrade/dist-upgrade +.TP +\-\-set\-install filename +Specify the file to which the details about the packages to be installed will be written to +.TP +\-\-set\-install\-packages [package names] +Specify the name of packages which you want to install +.TP +\-\-set\-install\-release [release name] +Specify the name of the release from which you want to download the packages. Eg. testing/unstable/experimental +.TP \-\-fetch\-update filename Specify the data file which contains the details about update files to be downloaded .TP +\-\-fetch\-upgrade filename +Specify the data file which contains the details about the package files to be downloaded +.TP +\-\-fetch\-bug\-reports +Fetch bug reports for the packages which are to be downloaded. Currently works only with Debian BTS +.TP +\-\-install\-update filename +Specify the archive file or folder path which contains the update data you downloaded +.TP +\-\-install\-upgrade filename +Specify the archive file or folder path which contains the package data you downloaded +.TP +\-z/\-\-zip +Zip the downloaded files to a single zip archive file +.TP +\-\-zip\-update\-file filename +Specify a zip file name for the downloaded files to be archived to. Default: pypt-offline-update.zip +.TP +\-\-zip\-upgrade\-file filename +Specify a zip file name for the downloaded files to be archived to. Default: pypt-offline-upgrade.zip +.TP \-\-threads N Specifiy the number of threads to be spawned (Default: 1) .TP +\-\-disable\-md5check +Disable MD5 Checksum. Default: False +.TP +\-d/\-\-download\-dir path +Path where the downloaded files will be saved to. Eg: C:\\debs or /var/tmp/debs +.TP +\-s/\-\-cache\-dir path +Path to search for files before downloading from the web. Eg: C:\\debs or /var/tmp/debs +.TP +\-\-socket\-timeout N +Set socket timeout value. Default: 30 +.TP +\-\-verbose +Enable verbose messages +.TP +\-\-test\-windows +This switch is used while doing testing on Microsoft Windows +.TP \-\-help display a short help text .TP \-\-version display the version of the progream + .SH EXAMPLES .TP -.B pypt-offline \-\-fetch\-update uris\-file +.B To keep your disconnected machine up-to-date, here are the examples +.TP +.B pypt-offline \-\-set\-update update_uris +This command will extract the details about the files that need to be fetched to update the package management database on the machine without internet connection. +.TP +.B pypt-offline \-\-fetch\-update update_uris +This command will fetch the required data as defined in the update_uris file and create a zip archive if the \-z option is used +.TP +.B pypt-offline \-\-install\-update pypt-offline-update.zip +This command will update your disconnected machine's package management database by extracting the data from the file pypt-offline-update.zip + +.TP +.B To upgrade/install packages on your disconnected machine, here are the examples +.TP +.B pypt-offline \-\-set\-upgrade upgrade_uris +This command will extract the details about the packages that need to be fetched to upgrade the softwares install on your machine without an internet connection. +.TP +.B pypt-offline \-\-fetch\-upgrade upgrade_uris +This command will fetch the required data as defined in the upgrade_uris file and create a zip archive if the \-z option is used. Else it will download it into the folder you specify. +.TP +.B pypt-offline \-\-install\-upgrade pypt-offline-upgrade.zip +This command will install packages to your disconnected machine's package management database by extracting the data from the file pypt-offlien-upgrade.zip. If you didn't use the \-z option, you will have to specify the directory path +Once the packages are synced, you can do the installation as you usually do by using "apt-get install package_name" or "apt-get upgrade". apt will not ask you to download any additional byte. + +.TP +.B Other important options to use with the above + +.TP +.B -z / --zip +This option, when used along with \-\-fetch\-up[date/grade], creates a archive file for the files which are downloaded. It becomes convenient to use a single zip archive file. +This option is highly recommended to be used but is not enable by default. + +.TP +.B --threads N +This option allows multiple downloads to be enabled. It spawns multiple threads when downloading. Use this when you have a high speed internet connection. +On a high speed internet connection, 5 is a good value to use. + +.TP +.B --disable-md5check +This option, if enabled, disables MD5 Checksum for the data which is downloaded. It is HIGHLY DISCOURAGED to use this option + +.TP +.B --fetch-bug-reports +This option, if enabled, fetched bug reports for packages which are being downloaded. Currently only Debian BTS is supported. +Disabled by default but highly recommened to use it. + .SH AUTHOR -Ritesh Raj Sarraf (rr...@re...) +.B Ritesh Raj Sarraf (rr...@re...) + +.SH BUGS +Currently there is no way to break out from the application which it is fetching the required packages. +This is because when multiple threads are spawned, the signal needs to be handled accordingly. This is in the TODO list. + + +If you wish to report a bug in pypt-offline, please see +.B http://sf.net/projects/pypt-offline +or send an email to me at +.B rr...@re... + .SH SEE ALSO -.SM apt(1) +.SM apt-get(8) +.SM apt-cache(8) +.SM dpkg(8) \ No newline at end of file Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-20 13:54:32 UTC (rev 190) +++ trunk/pypt_core.py 2007-08-21 20:28:35 UTC (rev 191) @@ -286,7 +286,7 @@ self.DispLock.acquire(True) self.set_color('Red') - sys.stderr.write(msg) + sys.stderr.write("ERROR: " + msg) sys.stderr.flush() self.set_color('SwitchOffAttributes') @@ -318,7 +318,7 @@ if self.VERBOSE is True: self.set_color('Cyan') - sys.stdout.write(msg) + sys.stdout.write("VERBOSE: " + msg) sys.stdout.flush() self.set_color('SwitchOffAttributes') @@ -710,7 +710,7 @@ sys.exit(errno) else: - log.err("Error: I don't understand this errorcode\n" % (errno)) + log.err("I don't understand this errorcode\n" % (errno)) sys.exit(errno) def get_pager_cmd(pager_cmd = None): @@ -799,7 +799,7 @@ os.mkdir("pypt-downloads") download_path = os.path.abspath("pypt-downloads") except: - log.err("Error: I couldn't create a directory") + log.err("I couldn't create a directory") errfunc(1, '') else: download_path = os.path.abspath(ArgumentOptions.download_dir) @@ -1270,12 +1270,12 @@ shutil.copy(archive_file, target_path + filename) retval = True else: - log.err("ERROR: Cannot write to target path %s\n" % (target_path) ) + log.err("Cannot write to target path %s\n" % (target_path) ) sys.exit(1) elif filename.endswith(pypt_bug_file_format): retval = False # We intentionally put the bug report files as not printed. else: - log.err("ERROR: I couldn't understand file type %s.\n" % (filename) ) + log.err("I couldn't understand file type %s.\n" % (filename) ) if retval is True: log.msg("%s file synced.\n" % (filename)) @@ -1383,7 +1383,7 @@ magic_check_and_uncompress(archive_file, target_path, filename) data.file.close() else: - log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") + log.err("Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") sys.exit(1) elif path_type == 2: @@ -1464,7 +1464,7 @@ magic_check_and_uncompress(archive_file, target_path, filename) else: - log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") + log.err("Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") sys.exit(1) def main(): @@ -1483,12 +1483,13 @@ help="Root directory path where the pre-downloaded files will be searched.Make sure you give the full path of the cache directory. If not, give a period '.'", action="store", type="string", metavar=".") parser.add_option("--verbose", dest="verbose", help="Enable verbose messages", action="store_true") - parser.add_option("-u","--uris", dest="uris_file", - help="Full path of the uris file which contains the main database of files to be downloaded",action="store", type="string") parser.add_option("","--disable-md5check", dest="disable_md5check", help="Disable md5checksum validation on downloaded files",action="store_false", default=False) parser.add_option("", "--threads", dest="num_of_threads", help="Number of threads to spawn", action="store", type="int", metavar="1", default=1) + parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true") + parser.add_option("", "--socket-timeout", dest="socket_timeout", help="Set the socket timeout value. Default is 30s.", + action="store", type="int", metavar="30", default=30) #INFO: Option zip is not enabled by default but is highly encouraged. parser.add_option("-z","--zip", dest="zip_it", help="Zip the downloaded files to a single zip file", action="store_true") @@ -1506,29 +1507,32 @@ action="store", metavar="pypt-offline-install.dat") parser.add_option("", "--set-install-packages", dest="set_install_packages", help="Name of the packages which need to be fetched", action="store_true", metavar="package_names") + parser.add_option("", "--set-install-release", dest="set_install_release", help="Name of the release from which packages need to be fetched", + action="store", metavar="release_name") parser.add_option("", "--set-update", dest="set_update", help="Extract the list of uris which need to be fetched for updation", action="store", type="string", metavar="pypt-offline-update.dat") - parser.add_option("", "--fetch-update", dest="fetch_update", - help="Fetch the list of uris which are needed for apt's databases _updation_. This command must be executed on the WITHNET machine", - action="store", type="string", metavar="pypt-offline-update.dat") - parser.add_option("", "--install-update", dest="install_update", - help="Install the fetched database files to the NONET machine and _update_ the apt database on the NONET machine. This command must be executed on the NONET machine", - action="store", type="string", metavar="pypt-offline-update.zip") parser.add_option("", "--set-upgrade", dest="set_upgrade", help="Extract the list of uris which need to be fetched for _upgradation_", action="store", type="string", metavar="pypt-offline-upgrade.dat") parser.add_option("", "--upgrade-type", dest="upgrade_type", help="Type of upgrade to do. Use one of upgrade, dist-upgrade, dselect-ugprade", action="store", type="string", metavar="upgrade") + + parser.add_option("", "--fetch-update", dest="fetch_update", + help="Fetch the list of uris which are needed for apt's databases _updation_. This command must be executed on the WITHNET machine", + action="store", type="string", metavar="pypt-offline-update.dat") parser.add_option("", "--fetch-upgrade", dest="fetch_upgrade", help="Fetch the list of uris which are needed for apt's databases _upgradation_. This command must be executed on the WITHNET machine", action="store", type="string", metavar="pypt-offline-upgrade.dat") + parser.add_option("", "--fetch-bug-reports", dest="deb_bugs", + help="Fetch bug reports from the BTS", action="store_true") + + parser.add_option("", "--install-update", dest="install_update", + help="Install the fetched database files to the NONET machine and _update_ the apt database on the NONET machine. This command must be executed on the NONET machine", + action="store", type="string", metavar="pypt-offline-update.zip") parser.add_option("", "--install-upgrade", dest="install_upgrade", help="Install the fetched packages to the NONET machine and _upgrade_ the packages on the NONET machine. This command must be executed on the NONET machine", action="store", type="string", metavar="pypt-offline-upgrade.zip") - parser.add_option("", "--fetch-bug-reports", dest="deb_bugs", - help="Fetch bug reports from the BTS", action="store_true") - parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true") #global options, args (options, args) = parser.parse_args() @@ -1542,6 +1546,15 @@ log.msg("Copyright %s\n" % (copyright)) log.msg(terminal_license) + if options.socket_timeout: + try: + options.socket_timeout.__int__() + socket.setdefaulttimeout(options.socket_timeout) + log.verbose("Default timeout now is: %d.\n" % (socket.getdefaulttimeout() ) ) + except AttributeError: + log.err("Incorrect value set for socket timeout.\n") + sys.exit(1) + if options.test_windows: global apt_package_target_path global apt_update_target_path @@ -1624,9 +1637,14 @@ for x in args: os.environ['__pypt_set_install_packages'] += x + ' ' - #FIXME: Find a more Pythonic implementation - if os.system('/usr/bin/apt-get -qq --print-uris install $__pypt_set_install_packages > $__pypt_set_install') != 0: - log.err("FATAL: Something is wrong with the apt system.\n") + if options.set_install_release: + os.environ['__pypt_set_install_release'] = options.set_install_release + if os.system('/usr/bin/apt-get -qq --print-uris -t $__pypt_set_install_release install $__pypt_set_install_packages > $__pypt_set_install') != 0: + log.err("FATAL: Something is wrong with the apt system.\n") + else: + #FIXME: Find a more Pythonic implementation + if os.system('/usr/bin/apt-get -qq --print-uris install $__pypt_set_install_packages > $__pypt_set_install') != 0: + log.err("FATAL: Something is wrong with the apt system.\n") else: parser.error("This argument is supported only on Unix like systems with apt installed\n") sys.exit(1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-20 13:54:30
|
Revision: 190 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=190&view=rev Author: riteshsarraf Date: 2007-08-20 06:54:32 -0700 (Mon, 20 Aug 2007) Log Message: ----------- * Much simpler to decide a True or a False Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-17 16:11:59 UTC (rev 189) +++ trunk/pypt_core.py 2007-08-20 13:54:32 UTC (rev 190) @@ -223,9 +223,7 @@ def __init__(self, verbose, lock = None): - if verbose is True: - self.VERBOSE = True - else: self.VERBOSE = False + self.VERBOSE = bool(verbose) self.color_syntax = '\033[1;' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-17 16:11:57
|
Revision: 189 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=189&view=rev Author: riteshsarraf Date: 2007-08-17 09:11:59 -0700 (Fri, 17 Aug 2007) Log Message: ----------- * If the $LANG environment variable is not set, just don't spit an exception Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-17 14:10:46 UTC (rev 188) +++ trunk/pypt_core.py 2007-08-17 16:11:59 UTC (rev 189) @@ -1562,7 +1562,10 @@ # When using locales, we get translation files. But apt doesn't extract the URI properly. # Once the extraction problem is root-caused, we can fix this easily. os.environ['__pypt_set_update'] = options.set_update - old_environ = os.environ['LANG'] + try: + old_environ = os.environ['LANG'] + except KeyError: + old_environ = "C" os.environ['LANG'] = "C" log.verbose("Set environment variable for LANG from %s to %s temporarily.\n" % (old_environ, os.environ['LANG']) ) if os.system('/usr/bin/apt-get -qq --print-uris update > $__pypt_set_update') != 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-17 14:10:43
|
Revision: 188 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=188&view=rev Author: riteshsarraf Date: 2007-08-17 07:10:46 -0700 (Fri, 17 Aug 2007) Log Message: ----------- * The variables need to be referenced as the global variables. Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-17 11:22:40 UTC (rev 187) +++ trunk/pypt_core.py 2007-08-17 14:10:46 UTC (rev 188) @@ -74,6 +74,7 @@ pypt_bug_file_format = "__pypt__bug__report" bugTypes = ["Resolved bugs", "Normal bugs", "Minor bugs", "Wishlist items", "FIXED"] + #These are spaces which will overwrite the progressbar left mess LINE_OVERWRITE_SMALL = " " * 10 LINE_OVERWRITE_MID = " " * 30 @@ -1543,6 +1544,12 @@ log.msg("Copyright %s\n" % (copyright)) log.msg(terminal_license) + if options.test_windows: + global apt_package_target_path + global apt_update_target_path + apt_package_target_path = 'C:\\temp' + apt_update_target_path = 'C:\\temp' + if options.set_update: if platform.system() in supported_platforms: if os.geteuid() != 0: @@ -1661,8 +1668,6 @@ if options.install_update: if options.test_windows: - # Dummy paths while testing on Windows - apt_update_target_path = 'C:\\temp' pass else: try: @@ -1678,15 +1683,13 @@ syncer(options.install_update, apt_update_target_path, 1, bug_parse_required = False) elif os.path.isdir(options.install_update) is True: # We're a directory - syncer(options.install_update, apt_update_target_path, 1, bug_parse_required = False) + syncer(options.install_update, apt_update_target_path, 2, bug_parse_required = False) else: log.err("%s file not found\n" % (options.install_update)) sys.exit(1) if options.install_upgrade: if options.test_windows: - # Dummy paths while testing on Windows - apt_package_target_path = 'C:\\temp' pass else: try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-17 11:22:38
|
Revision: 187 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=187&view=rev Author: riteshsarraf Date: 2007-08-17 04:22:40 -0700 (Fri, 17 Aug 2007) Log Message: ----------- * Put proper variable assignments where required Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-17 11:14:50 UTC (rev 186) +++ trunk/pypt_core.py 2007-08-17 11:22:40 UTC (rev 187) @@ -1663,7 +1663,6 @@ if options.test_windows: # Dummy paths while testing on Windows apt_update_target_path = 'C:\\temp' - apt_package_target_path = 'C:\\temp' pass else: try: @@ -1687,7 +1686,6 @@ if options.install_upgrade: if options.test_windows: # Dummy paths while testing on Windows - apt_update_target_path = 'C:\\temp' apt_package_target_path = 'C:\\temp' pass else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-17 11:14:51
|
Revision: 186 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=186&view=rev Author: riteshsarraf Date: 2007-08-17 04:14:50 -0700 (Fri, 17 Aug 2007) Log Message: ----------- C:\Eclipse\Workspace\pypt-offline>hg log -l 2 -v changeset: 166:a0954cf2b81a branch: trunk tag: tip user: Ritesh Raj Sarraf <rr...@re...> date: Fri Aug 17 16:41:35 2007 +0530 files: pypt_core.py description: * Add option --test-windows to avoid the call of os.geteuid() on Windows. changeset: 165:a4e7b8f2b038 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Fri Aug 17 16:33:03 2007 +0530 files: pypt_core.py description: * Put all imports at the top-level. This has already hurt much. Things are done for good. Folloow standard practices. Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-13 20:51:03 UTC (rev 185) +++ trunk/pypt_core.py 2007-08-17 11:14:50 UTC (rev 186) @@ -31,12 +31,16 @@ import socket import tempfile -from array import array +import zipfile +import bz2 +import gzip -#INFO: Set the default timeout to 15 seconds for the packages that are being downloaded. -socket.setdefaulttimeout(30) +import debianbts +import pypt_magic +from array import array + #INFO: They aren't on Windows try: from fcntl import ioctl @@ -50,6 +54,10 @@ except ImportError: WindowColor = False +#INFO: Set the default timeout to 15 seconds for the packages that are being downloaded. +socket.setdefaulttimeout(30) + + '''This is the core module. It does the main job of downloading packages/update packages,\nfiguring out if the packages are in the local cache, handling exceptions and many more stuff''' @@ -62,9 +70,6 @@ supported_platforms = ["Linux", "GNU/kFreeBSD", "GNU"] apt_update_target_path = '/var/lib/apt/lists/' apt_package_target_path = '/var/cache/apt/archives/' -# Dummy paths while testing on Windows -#apt_update_target_path = 'C:\\temp' -#apt_package_target_path = 'C:\\temp' pypt_bug_file_format = "__pypt__bug__report" bugTypes = ["Resolved bugs", "Normal bugs", "Minor bugs", "Wishlist items", "FIXED"] @@ -86,7 +91,6 @@ def md5_check(self, file, checksum): data = open(file, 'rb') - #local = md5_string(data) if checksum == self.md5_string(data): return True return False @@ -242,10 +246,6 @@ elif os.name in ['nt', 'dos']: self.platform = None - #try: - # import WConio - #except ImportError: - # self.platform = None if WindowColor is True: self.platform = 'microsoft' @@ -346,11 +346,6 @@ '''Condenses all the files into one single file for easy transfer''' try: - import zipfile - except ImportError: - return False - - try: if self.lock: self.ZipLock.acquire(True) filename = zipfile.ZipFile(zip_file_name, "a") @@ -374,10 +369,6 @@ if archive_type is 1: - try: - import bz2 - except ImportError: - return False try: read_from = bz2.BZ2File(archive_file, 'r') @@ -396,10 +387,6 @@ return True elif archive_type is 2: - try: - import gzip - except ImportError: - return False try: read_from = gzip.GzipFile(archive_file, 'r') @@ -419,10 +406,10 @@ elif archive_type is 3: # FIXME: This looks odd. Where are we writing to a file ??? - #try: - zip_file = zipfile.ZipFile(file, 'rb') - #except: - # return False + try: + zip_file = zipfile.ZipFile(file, 'rb') + except IOError: + return False for filename in zip_file.namelist(): data = zip_file.read() @@ -444,16 +431,9 @@ if self.lock: Archiver.__init__(self, lock) self.ArchiveFile = ArchiveFile - #ArchiveFiles = Archiver(True) - #import debianbts def FetchBugsDebian(self, PackageName, Filename=None): - try: - import debianbts - except ImportError: - return False - if Filename != None: try: file_handle = open(Filename, 'a') @@ -895,7 +875,6 @@ if FetcherInstance.compress_the_file(zip_update_file, file) != True: log.verbose("%s added to archive %s.\n" % (file, zip_update_file) ) os.unlink(os.path.join(download_path, file) ) # Remove it because we don't need the file once it is zipped. - #sys.exit(1) pass elif key == 'Upgrade': @@ -1259,12 +1238,6 @@ archive = Archiver() - try: - import pypt_magic - except ImportError: - log.err("Error: Module pypt_magic not found.\n") - sys.exit(1) - def display_options(): log.msg("(Y) Yes. Proceed with installation\n") @@ -1308,12 +1281,6 @@ log.msg("%s file synced.\n" % (filename)) if path_type == 1: - - try: - import zipfile - except ImportError: - log.err("Error: Module zipfile not found.\n") - sys.exit(1) file = zipfile.ZipFile(install_file_path, "r") if bug_parse_required is True: @@ -1562,6 +1529,7 @@ action="store", type="string", metavar="pypt-offline-upgrade.zip") parser.add_option("", "--fetch-bug-reports", dest="deb_bugs", help="Fetch bug reports from the BTS", action="store_true") + parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true") #global options, args (options, args) = parser.parse_args() @@ -1692,14 +1660,19 @@ sys.exit(1) if options.install_update: - #INFO: Comment these lines to do testing on Windows machines too - #try: - # if os.geteuid() != 0: - # log.err("\nYou need superuser privileges to execute this option\n") - # sys.exit(1) - #except AttributeError: - # log.err("Are you really running the install command on a Debian box?\n") - # sys.exit(1) + if options.test_windows: + # Dummy paths while testing on Windows + apt_update_target_path = 'C:\\temp' + apt_package_target_path = 'C:\\temp' + pass + else: + try: + if os.geteuid() != 0: + log.err("\nYou need superuser privileges to execute this option\n") + sys.exit(1) + except AttributeError: + log.err("Are you really running the install command on a Debian box?\n") + sys.exit(1) if os.path.isfile(options.install_update) is True: # Okay! We're a file. It should be a zip file @@ -1712,14 +1685,20 @@ sys.exit(1) if options.install_upgrade: - #INFO: Comment these lines to do testing on Windows machines too - #try: - # if os.geteuid() != 0: - # log.err("\nYou need superuser privileges to execute this option\n") - # sys.exit(1) - #except AttributeError: - # log.err("Are you really running the install command on a Debian box?\n") - # sys.exit(1) + if options.test_windows: + # Dummy paths while testing on Windows + apt_update_target_path = 'C:\\temp' + apt_package_target_path = 'C:\\temp' + pass + else: + try: + if os.geteuid() != 0: + log.err("\nYou need superuser privileges to execute this option\n") + sys.exit(1) + except AttributeError: + log.err("Are you really running the install command on a Debian box?\n") + sys.exit(1) + if os.path.isfile(options.install_upgrade) is True: syncer(options.install_upgrade, apt_package_target_path, 1, bug_parse_required = True) elif os.path.isdir(options.install_upgrade) is True: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-13 20:51:02
|
Revision: 185 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=185&view=rev Author: riteshsarraf Date: 2007-08-13 13:51:03 -0700 (Mon, 13 Aug 2007) Log Message: ----------- rrs@learner:~/devel/eclipse/pypt-offline$ hg log -l 6 -v changeset: 164:0e25f5b1fd9a branch: trunk tag: tip user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 14 02:10:06 2007 +0530 files: pypt_core.py description: * Updated all magic_check_and_uncompress() call's with proper arguments * Catch IOError in Archiver changeset: 163:6305da9154bd branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 14 01:47:37 2007 +0530 files: pypt_core.py description: * We were checking for the wrong file in pypt_magic.file() * Same was for shutil.copy * Fixed the temporary file write stull. tempfile is much better to do it. changeset: 162:97589b94d83a branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 14 01:23:15 2007 +0530 files: pypt_core.py description: * When the target path is not writable, we indeed need to errorout and exit. changeset: 161:01818b3bab35 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Tue Aug 14 01:05:25 2007 +0530 files: pypt_core.py description: * Let's hope that this way of trying to get the bug's subject works * properly everywhere. changeset: 160:ae2409fc7057 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Mon Aug 13 04:50:22 2007 +0530 files: pypt_core.py description: * String Formatiing updates changeset: 159:93d78fc4d770 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Mon Aug 13 02:33:20 2007 +0530 files: pypt_core.py description: * Fixed variable vame error Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-12 20:31:08 UTC (rev 184) +++ trunk/pypt_core.py 2007-08-13 20:51:03 UTC (rev 185) @@ -29,6 +29,7 @@ import optparse import array import socket +import tempfile from array import array @@ -55,7 +56,7 @@ version = "0.7.0" copyright = "(C) 2005 - 2007 Ritesh Raj Sarraf - RESEARCHUT (http://www.researchut.com/)" terminal_license = "This program comes with ABSOLUTELY NO WARRANTY.\n\ -This is free software, and you are welcome to redistribute it under certain conditions.\n" +This is free software, and you are welcome to redistribute it under certain conditions.\n\n\n" errlist = [] supported_platforms = ["Linux", "GNU/kFreeBSD", "GNU"] @@ -378,15 +379,15 @@ except ImportError: return False - #try: - read_from = bz2.BZ2File(archive_file, 'r') - #except: - # return False + try: + read_from = bz2.BZ2File(archive_file, 'r') + except IOError: + return False - #try: - write_to = open (os.path.join(path, target_file), 'wb') - #except: - # return False + try: + write_to = open (os.path.join(path, target_file), 'wb') + except IOError: + return False if self.TarGzipBZ2_Uncompress(read_from, write_to) != True: raise ArchiveError @@ -400,15 +401,15 @@ except ImportError: return False - #try: - read_from = gzip.GzipFile(file, 'r') - #except: - # return False + try: + read_from = gzip.GzipFile(archive_file, 'r') + except IOError: + return False - #try: - write_to = open(os.path.join(path,filename), 'wb') - #except: - # return False + try: + write_to = open(os.path.join(path,target_file), 'wb') + except IOError: + return False if self.TarGzipBZ2_Uncompress(read_from, write_to) != True: raise ArchiveError @@ -1292,19 +1293,19 @@ retval = archive.decompress_the_file(archive_file, target_path, filename, 2) elif pypt_magic.file(archive_file) == "application/zip": retval = archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 3) - elif pypt_magic.file(filename) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": + elif pypt_magic.file(archive_file) == "PGP armored data" or pypt_magic.file(archive_file) == "application/x-dpkg": if os.access(target_path, os.W_OK): - shutil.copy(filename, target_path) + shutil.copy(archive_file, target_path + filename) retval = True else: - log.err("ERROR: Cannot write to target path %s.\n" % (target_path) ) + log.err("ERROR: Cannot write to target path %s\n" % (target_path) ) + sys.exit(1) elif filename.endswith(pypt_bug_file_format): retval = False # We intentionally put the bug report files as not printed. else: log.err("ERROR: I couldn't understand file type %s.\n" % (filename) ) if retval is True: log.msg("%s file synced.\n" % (filename)) - os.unlink(archive_file) if path_type == 1: @@ -1320,14 +1321,17 @@ bugs_number = {} for filename in file.namelist(): if filename.endswith(pypt_bug_file_format): - bug_subject_file = file.read(filename) - bug_subject = bug_subject_file.split('\r') - del bug_subject_file - for subject in bug_subject: - if subject.startswith('#'): - subject = subject.lstrip(subject.split(":")[0]) + temp = tempfile.NamedTemporaryFile() + temp.file.write(file.read(filename)) + temp.file.flush() + temp.file.seek(0) #Let's go back to the start of the file + for bug_subject_identifier in temp.file.readlines(): + if bug_subject_identifier.startswith('#'): + subject = bug_subject_identifier.lstrip(bug_subject_identifier.split(":")[0]) + subject = subject.rstrip("\n") break bugs_number[filename] = subject + temp.file.close() if bugs_number: # Display the list of bugs @@ -1343,23 +1347,13 @@ elif response.startswith('y') or response.startswith('Y'): for filename in file.namelist(): - data = open(filename, "wb") - data.write(file.read(filename)) - data.close() + data = tempfile.NamedTemporaryFile() + data.file.write(file.read(filename)) + data.file.flush() + archive_file = data.name - #FIXME: Fix this tempfile feature - # Access to the temporary file is not being allowed - # It's throwing a Permission denied exception - #try: - # import tempfile - #except ImportError: - # sys.stderr.write("Aieeee! Module pypt_magic not found.\n") - # sys.exit(1) - #data = tempfile.NamedTemporaryFile('wb', -1, '', '', os.curdir) - #data.write(file.read(filename)) - #data = file.read(filename) - - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + magic_check_and_uncompress(archive_file, target_path, filename) + data.file.close() sys.exit(0) elif response.startswith('n') or response.startswith('N'): @@ -1401,11 +1395,13 @@ log.verbose("Continuing with syncing the files.\n") for filename in file.namelist(): - data = open(filename, "wb") - data.write(file.read(filename)) - data.close() - - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + data = tempfile.NamedTemporaryFile() + data.file.write(file.read(filename)) + data.file.flush() + archive_file = data.name + + magic_check_and_uncompress(archive_file, target_path, filename) + data.file.close() else: log.msg("Exiting gracefully on user request.\n") sys.exit(0) @@ -1413,22 +1409,13 @@ for filename in file.namelist(): - data = open(filename, "wb") - data.write(file.read(filename)) - data.close() + data = tempfile.NamedTemporaryFile() + data.file.write(file.read(filename)) + data.file.flush() + archive_file = data.name - #FIXME: Fix this tempfile feature - # Access to the temporary file is not being allowed - # It's throwing a Permission denied exception - #try: - # import tempfile - #except ImportError: - # sys.stderr.write("Aieeee! Module pypt_magic not found.\n") - # sys.exit(1) - #data = tempfile.NamedTemporaryFile('wb', -1, '', '', os.curdir) - #data.write(file.read(filename)) - #data = file.read(filename) - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + magic_check_and_uncompress(archive_file, target_path, filename) + data.file.close() else: log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") sys.exit(1) @@ -1458,7 +1445,7 @@ for eachfile in os.listdir(install_file_path): archive_type = None - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + magic_check_and_uncompress(archive_file, target_path, filename) elif response.startswith('n') or response.startswith('N'): log.err("Exiting gracefully on user request.\n\n") @@ -1501,7 +1488,7 @@ for eachfile in os.listdir(install_file_path): archive_type = None - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + magic_check_and_uncompress(archive_file, target_path, filename) else: log.msg("Exiting gracefully on user request.\n") sys.exit(0) @@ -1509,7 +1496,7 @@ for eachfile in os.listdir(install_file_path): archive_type = None - magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + magic_check_and_uncompress(archive_file, target_path, filename) else: log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") sys.exit(1) @@ -1593,7 +1580,7 @@ if os.geteuid() != 0: parser.error("This option requires super-user privileges. Execute as root or use sudo/su") else: - log.msg("Generating database of files that are needed for an update.\n") + log.msg("\n\nGenerating database of files that are needed for an update.\n") #FIXME: Unicode Fix # This is only a workaround. @@ -1622,17 +1609,17 @@ parser.error("This option requires super-user privileges. Execute as root or use sudo/su") #TODO: Use a more Pythonic way for it if options.upgrade_type == "upgrade": - log.msg("Generating database of files that are needed for an upgrade.\n") + log.msg("\n\nGenerating database of files that are needed for an upgrade.\n") os.environ['__pypt_set_upgrade'] = options.set_upgrade if os.system('/usr/bin/apt-get -qq --print-uris upgrade > $__pypt_set_upgrade') != 0: log.err("FATAL: Something is wrong with the apt system.\n") elif options.upgrade_type == "dist-upgrade": - log.msg("Generating database of files that are needed for a dist-upgrade.\n") + log.msg("\n\nGenerating database of files that are needed for a dist-upgrade.\n") os.environ['__pypt_set_upgrade'] = options.set_upgrade if os.system('/usr/bin/apt-get -qq --print-uris dist-upgrade > $__pypt_set_upgrade') != 0: log.err("FATAL: Something is wrong with the apt system.\n") elif options.upgrade_type == "dselect-upgrade": - log.msg("Generating database of files that are needed for a dselect-upgrade.\n") + log.msg("\n\nGenerating database of files that are needed for a dselect-upgrade.\n") os.environ['__pypt_set_upgrade'] = options.set_upgrade if os.system('/usr/bin/apt-get -qq --print-uris dselect-upgrade > $__pypt_set_upgrade') != 0: log.err("FATAL: Something is wrong with the apt system.\n") @@ -1650,7 +1637,7 @@ if os.geteuid() != 0: parser.error("This option requires super-user privileges. Execute as root or use sudo/su") - log.msg("Generating database of the package and its dependencies.\n") + log.msg("\n\nGenerating database of the package and its dependencies.\n") os.environ['__pypt_set_install'] = options.set_install os.environ['__pypt_set_install_packages'] = '' @@ -1726,13 +1713,13 @@ if options.install_upgrade: #INFO: Comment these lines to do testing on Windows machines too - try: - if os.geteuid() != 0: - log.err("\nYou need superuser privileges to execute this option\n") - sys.exit(1) - except AttributeError: - log.err("Are you really running the install command on a Debian box?\n") - sys.exit(1) + #try: + # if os.geteuid() != 0: + # log.err("\nYou need superuser privileges to execute this option\n") + # sys.exit(1) + #except AttributeError: + # log.err("Are you really running the install command on a Debian box?\n") + # sys.exit(1) if os.path.isfile(options.install_upgrade) is True: syncer(options.install_upgrade, apt_package_target_path, 1, bug_parse_required = True) elif os.path.isdir(options.install_upgrade) is True: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-12 20:31:06
|
Revision: 184 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=184&view=rev Author: riteshsarraf Date: 2007-08-12 13:31:08 -0700 (Sun, 12 Aug 2007) Log Message: ----------- * It was very wrong to put a try: without a proper exception clause. Never do it. * Fixed TarGzipBZ2_Uncompress() call. It was stupidly wrong written. * Some string formatting fixes * Pass syncer a more descriptive variable name and identify whether bug parsing is required or not. For updates, we don't do bug parsing. * Put the imports more properly. The import doesn't need to be done separately under each if * Unclutter the code for pypt_magic parsing. Introduced the magic_check_and_uncompress() * In magic_check_and_uncompress, for bug report files, we don't need to do anything to them and should safely ignore them Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-12 02:55:04 UTC (rev 183) +++ trunk/pypt_core.py 2007-08-12 20:31:08 UTC (rev 184) @@ -378,17 +378,17 @@ except ImportError: return False - try: - read_from = bz2.BZ2File(archive_file, 'r') - except: - return False + #try: + read_from = bz2.BZ2File(archive_file, 'r') + #except: + # return False - try: - write_to = open (os.path.join(path, filename), 'wb') - except: - return False + #try: + write_to = open (os.path.join(path, target_file), 'wb') + #except: + # return False - if TarGzipBZ2_Uncomprerssed(read_from, write_to) != True: + if self.TarGzipBZ2_Uncompress(read_from, write_to) != True: raise ArchiveError write_to.close() read_from.close() @@ -400,17 +400,17 @@ except ImportError: return False - try: - read_from = gzip.GzipFile(file, 'r') - except: - return False + #try: + read_from = gzip.GzipFile(file, 'r') + #except: + # return False - try: - write_to = open(os.path.join(path,filename), 'wb') - except: - return False + #try: + write_to = open(os.path.join(path,filename), 'wb') + #except: + # return False - if TarGzipBZ2_Uncomprerssed(read_from, write_to) != True: + if self.TarGzipBZ2_Uncompress(read_from, write_to) != True: raise ArchiveError write_to.close() read_from.close() @@ -418,10 +418,10 @@ elif archive_type is 3: # FIXME: This looks odd. Where are we writing to a file ??? - try: - zip_file = zipfile.ZipFile(file, 'rb') - except: - return False + #try: + zip_file = zipfile.ZipFile(file, 'rb') + #except: + # return False for filename in zip_file.namelist(): data = zip_file.read() @@ -730,7 +730,7 @@ sys.exit(errno) else: - log.err("Aieee! I don't understand this errorcode\n" % (errno)) + log.err("Error: I don't understand this errorcode\n" % (errno)) sys.exit(errno) def get_pager_cmd(pager_cmd = None): @@ -819,7 +819,7 @@ os.mkdir("pypt-downloads") download_path = os.path.abspath("pypt-downloads") except: - log.err("Aieeee! I couldn't create a directory") + log.err("Error: I couldn't create a directory") errfunc(1, '') else: download_path = os.path.abspath(ArgumentOptions.download_dir) @@ -1243,18 +1243,27 @@ for error in errlist: log.err("%s failed.\n" % (error)) -def syncer(install_file_path, target_path, arg_type=None): - '''Syncer does the work of syncing the downloaded files. +def syncer(install_file_path, target_path, path_type=None, bug_parse_required=None): + ''' + Syncer does the work of syncing the downloaded files. It syncs "install_file_path" which could be a valid file path or a zip archive to "target_path" - arg_type defines whether install_file_path is a zip file + path_type defines whether install_file_path is a zip file or a folder path + # path_type 1 => install_file_path is a File - 2 => install_file_path is a Folder''' + 2 => install_file_path is a Folder + ''' archive = Archiver() + try: + import pypt_magic + except ImportError: + log.err("Error: Module pypt_magic not found.\n") + sys.exit(1) + def display_options(): log.msg("(Y) Yes. Proceed with installation\n") @@ -1275,231 +1284,235 @@ bug_subject = bugs_number[each_bug] log.msg("%s\t%s\n" % (bug_num, bug_subject) ) - if arg_type == 1: + def magic_check_and_uncompress(archive_file=None, target_path=None, filename=None, Mode=None): + + if pypt_magic.file(archive_file) == "application/x-bzip2": + retval = archive.decompress_the_file(archive_file, target_path, filename, 1) + elif pypt_magic.file(archive_file) == "application/x-gzip": + retval = archive.decompress_the_file(archive_file, target_path, filename, 2) + elif pypt_magic.file(archive_file) == "application/zip": + retval = archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 3) + elif pypt_magic.file(filename) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": + if os.access(target_path, os.W_OK): + shutil.copy(filename, target_path) + retval = True + else: + log.err("ERROR: Cannot write to target path %s.\n" % (target_path) ) + elif filename.endswith(pypt_bug_file_format): + retval = False # We intentionally put the bug report files as not printed. + else: + log.err("ERROR: I couldn't understand file type %s.\n" % (filename) ) + if retval is True: + log.msg("%s file synced.\n" % (filename)) + os.unlink(archive_file) + + if path_type == 1: + try: import zipfile except ImportError: - log.err("Aieeee! Module zipfile not found.\n") + log.err("Error: Module zipfile not found.\n") sys.exit(1) - try: - import pypt_magic - except ImportError: - log.err("Aieeee! Module pypt_magic not found.\n") - sys.exit(1) - file = zipfile.ZipFile(install_file_path, "r") - bugs_number = {} - for filename in file.namelist(): - if filename.endswith(pypt_bug_file_format): - bug_subject_file = file.read(filename) - bug_subject = bug_subject_file.split('\r') - del bug_subject_file - for subject in bug_subject: - if subject.startswith('#'): - subject = subject.lstrip(subject.split(":")[0]) - break - bugs_number[filename] = subject + if bug_parse_required is True: - if bugs_number: - # Display the list of bugs - list_bugs() - display_options() - response = get_response() - - while True: - if response == "?": - display_options() - response = get_response() + bugs_number = {} + for filename in file.namelist(): + if filename.endswith(pypt_bug_file_format): + bug_subject_file = file.read(filename) + bug_subject = bug_subject_file.split('\r') + del bug_subject_file + for subject in bug_subject: + if subject.startswith('#'): + subject = subject.lstrip(subject.split(":")[0]) + break + bugs_number[filename] = subject - elif response.startswith('y') or response.startswith('Y'): + if bugs_number: + # Display the list of bugs + list_bugs() + display_options() + response = get_response() + + while True: + if response == "?": + display_options() + response = get_response() + + elif response.startswith('y') or response.startswith('Y'): + for filename in file.namelist(): + + data = open(filename, "wb") + data.write(file.read(filename)) + data.close() + + #FIXME: Fix this tempfile feature + # Access to the temporary file is not being allowed + # It's throwing a Permission denied exception + #try: + # import tempfile + #except ImportError: + # sys.stderr.write("Aieeee! Module pypt_magic not found.\n") + # sys.exit(1) + #data = tempfile.NamedTemporaryFile('wb', -1, '', '', os.curdir) + #data.write(file.read(filename)) + #data = file.read(filename) + + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + sys.exit(0) + + elif response.startswith('n') or response.startswith('N'): + log.err("Exiting gracefully on user request.\n\n") + sys.exit(0) + + elif response.isdigit() is True: + found = False + for full_bug_file_name in bugs_number: + if response in full_bug_file_name: + bug_file_to_display = full_bug_file_name + found = True + break + if found == False: + log.err("Incorrect bug number %s provided.\n" % (response) ) + response = get_response() + + if found: + display_pager = PagerCmd() + retval = display_pager.send_to_pager(file.read(bug_file_to_display) ) + if retval == 1: + log.err("Broken pager. Can't display the bug details.\n") + # Redisplay the menu + # FIXME: See a pythonic possibility of cleaning the screen at this stage + response = get_response() + + elif response.startswith('r') or response.startswith('R'): + list_bugs() + response = get_response() + + else: + log.err('Incorrect choice. Exiting\n') + sys.exit(1) + else: + log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") + response = raw_input("Continue with Installation. Y/N ?") + response = response.rstrip("\r") + if response.endswith('y') or response.endswith('Y'): + log.verbose("Continuing with syncing the files.\n") for filename in file.namelist(): data = open(filename, "wb") data.write(file.read(filename)) data.close() - #FIXME: Fix this tempfile feature - # Access to the temporary file is not being allowed - # It's throwing a Permission denied exception - #try: - # import tempfile - #except ImportError: - # sys.stderr.write("Aieeee! Module pypt_magic not found.\n") - # sys.exit(1) - #data = tempfile.NamedTemporaryFile('wb', -1, '', '', os.curdir) - #data.write(file.read(filename)) - #data = file.read(filename) - - if pypt_magic.file(os.path.abspath(filename)) == "application/x-bzip2": - archive.decompress_the_file(os.path.abspath(filename), target_path, filename, 1) - elif pypt_magic.file(os.path.abspath(filename)) == "application/x-gzip": - archive.decompress_the_file(os.path.abspath(filename), target_path, filename, 2) - elif pypt_magic.file(filename) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": - if os.access(target_path, os.W_OK): - shutil.copy(filename, target_path) - log.msg("%s file synced.\n" % (filename)) - os.unlink(filename) - - elif response.startswith('n') or response.startswith('N'): - log.err("Exiting gracefully on user request.\n\n") + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + else: + log.msg("Exiting gracefully on user request.\n") sys.exit(0) + elif bug_parse_required is False: + + for filename in file.namelist(): + + data = open(filename, "wb") + data.write(file.read(filename)) + data.close() + + #FIXME: Fix this tempfile feature + # Access to the temporary file is not being allowed + # It's throwing a Permission denied exception + #try: + # import tempfile + #except ImportError: + # sys.stderr.write("Aieeee! Module pypt_magic not found.\n") + # sys.exit(1) + #data = tempfile.NamedTemporaryFile('wb', -1, '', '', os.curdir) + #data.write(file.read(filename)) + #data = file.read(filename) + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + else: + log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") + sys.exit(1) + + elif path_type == 2: + archive_file_types = ['application/x-bzip2', 'application/gzip', 'application/zip'] + + if bug_parse_required is True: + bugs_number = [] + for filename in os.listdir(install_file_path): + if filename.endswith(pypt_bug_file_format): + bugs_number.append(filename) - elif response.isdigit() is True: - found = False - for full_bug_file_name in bugs_number: - if response in full_bug_file_name: - bug_file_to_display = full_bug_file_name - found = True - break - if found == False: - log.err("Incorrect bug number %s provided.\n" % (response) ) + if bugs_number: + #Give the choice to the user + list_bugs() + display_options() + response = get_response() + + while True: + if response == "?": + display_options() response = get_response() - - if found: - display_pager = PagerCmd() - retval = display_pager.send_to_pager(file.read(bug_file_to_display) ) - if retval == 1: - log.err("Broken pager. Can't display the bug details.\n") - # Redisplay the menu - # FIXME: See a pythonic possibility of cleaning the screen at this stage + + elif response.startswith('y') or response.startswith('Y'): + + for eachfile in os.listdir(install_file_path): + archive_type = None + + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + + elif response.startswith('n') or response.startswith('N'): + log.err("Exiting gracefully on user request.\n\n") + sys.exit(0) + + elif response.isdigit() is True: + found = False + for full_bug_file_name in bugs_number: + if response in full_bug_file_name: + bug_file_to_display = full_bug_file_name + found = True + break + if found == False: + log.err("Incorrect bug number %s provided.\n" % (response) ) + response = get_response() + + if found: + display_pager = PagerCmd() + retval = display_pager.send_to_pager(file.read(bug_file_to_display) ) + if retval == 1: + log.err("Broken pager. Can't display the bug details.\n") + # Redisplay the menu + # FIXME: See a pythonic possibility of cleaning the screen at this stage + response = get_response() + + elif response.startswith('r') or response.startswith('R'): + list_bugs() response = get_response() - - elif response.startswith('r') or response.startswith('R'): - list_bugs() - response = get_response() - - else: - log.err('Incorrect choice. Exiting\n') - sys.exit(1) - else: - log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") - response = raw_input("Continue with Installation. Y/N ?") - response = response.rstrip("\r") - if response.endswith('y') or response.endswith('Y'): - log.verbose("Continuing with syncing the files.\n") - for filename in file.namelist(): - - data = open(filename, "wb") - data.write(file.read(filename)) - data.close() - - if pypt_magic.file(os.path.abspath(filename)) == "application/x-bzip2": - archive.decompress_the_file(os.path.abspath(filename), target_path, filename, 1) - elif pypt_magic.file(os.path.abspath(filename)) == "application/x-gzip": - archive.decompress_the_file(os.path.abspath(filename), target_path, filename, 2) - elif pypt_magic.file(filename) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": - if os.access(target_path, os.W_OK): - shutil.copy(filename, target_path) - log.msg("%s file synced.\n" % (filename)) - os.unlink(filename) + + else: + log.err('Incorrect choice. Exiting\n') + sys.exit(1) else: - log.msg("Exiting gracefully on user request.\n") - sys.exit(0) + log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") + response = raw_input("Continue with Installation. Y/N?") + response = response.rstrip("\r") - elif arg_type == 2: - archive_file_types = ['application/x-bzip2', 'application/gzip', 'application/zip'] - - bugs_number = [] - for filename in os.listdir(install_file_path): - if filename.endswith(pypt_bug_file_format): - bugs_number.append(filename) - - if bugs_number: - #Give the choice to the user - list_bugs() - display_options() - response = get_response() - - while True: - if response == "?": - display_options() - response = get_response() - - elif response.startswith('y') or response.startswith('Y'): - + if response.startswith('y') or response.startswith('Y'): + for eachfile in os.listdir(install_file_path): archive_type = None - try: - import pypt_magic - except ImportError: - log.err("Aieeee! module not found.\n") - sys.exit(1) - if pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/x-bzip2": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 1) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/gzip": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 2) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/zip": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 3) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": - if os.access(target_path, os.W_OK): - shutil.copy(os.path.join(install_file_path, eachfile), target_path) - log.msg("%s file synced.\n" % (eachfile)) - else: - log.err("Aieeee! I don't understand filetype %s\n" % (eachfile)) - - elif response.startswith('n') or response.startswith('N'): - log.err("Exiting gracefully on user request.\n\n") + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) + else: + log.msg("Exiting gracefully on user request.\n") sys.exit(0) + elif bug_parse_required is False: + for eachfile in os.listdir(install_file_path): + archive_type = None - elif response.isdigit() is True: - found = False - for full_bug_file_name in bugs_number: - if response in full_bug_file_name: - bug_file_to_display = full_bug_file_name - found = True - break - if found == False: - log.err("Incorrect bug number %s provided.\n" % (response) ) - response = get_response() - - if found: - display_pager = PagerCmd() - retval = display_pager.send_to_pager(file.read(bug_file_to_display) ) - if retval == 1: - log.err("Broken pager. Can't display the bug details.\n") - # Redisplay the menu - # FIXME: See a pythonic possibility of cleaning the screen at this stage - response = get_response() - - elif response.startswith('r') or response.startswith('R'): - list_bugs() - response = get_response() - - else: - log.err('Incorrect choice. Exiting\n') - sys.exit(1) + magic_check_and_uncompress(os.path.abspath(filename), target_path, filename) else: - log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") - response = raw_input("Continue with Installation. Y/N?") - response = response.rstrip("\r") - - if response.startswith('y') or response.startswith('Y'): - - for eachfile in os.listdir(install_file_path): - archive_type = None - try: - import pypt_magic - except ImportError: - log.err("Aieeee! module not found.\n") - sys.exit(1) - - if pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/x-bzip2": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 1) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/gzip": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 2) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "application/zip": - archive.decompress_the_file(os.path.join(install_file_path, eachfile), target_path, eachfile, 3) - elif pypt_magic.file(os.path.join(install_file_path, eachfile)) == "PGP armored data" or pypt_magic.file(filename) == "application/x-dpkg": - if os.access(target_path, os.W_OK): - shutil.copy(os.path.join(install_file_path, eachfile), target_path) - log.msg("%s file synced.\n" % (eachfile)) - else: - log.err("Aieeee! I don't understand filetype %s\n" % (eachfile)) - else: - log.msg("Exiting gracefully on user request.\n") - sys.exit(0) + log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n") + sys.exit(1) def main(): '''Here we basically do the sanity checks, some validations @@ -1693,33 +1706,37 @@ if options.install_update: #INFO: Comment these lines to do testing on Windows machines too - if os.geteuid() != 0: - log.err("\nYou need superuser privileges to execute this option\n") - sys.exit(1) + #try: + # if os.geteuid() != 0: + # log.err("\nYou need superuser privileges to execute this option\n") + # sys.exit(1) + #except AttributeError: + # log.err("Are you really running the install command on a Debian box?\n") + # sys.exit(1) if os.path.isfile(options.install_update) is True: # Okay! We're a file. It should be a zip file - syncer(options, 1) + syncer(options.install_update, apt_update_target_path, 1, bug_parse_required = False) elif os.path.isdir(options.install_update) is True: # We're a directory - syncer(options, 2) + syncer(options.install_update, apt_update_target_path, 1, bug_parse_required = False) else: log.err("%s file not found\n" % (options.install_update)) sys.exit(1) if options.install_upgrade: #INFO: Comment these lines to do testing on Windows machines too - #try: - # if os.geteuid() != 0: - # log.err("\nYou need superuser privileges to execute this option\n") - # sys.exit(1) - #except AttributeError: - # log.err("Are you really running the install command on a Debian box?\n") - # sys.exit(1) + try: + if os.geteuid() != 0: + log.err("\nYou need superuser privileges to execute this option\n") + sys.exit(1) + except AttributeError: + log.err("Are you really running the install command on a Debian box?\n") + sys.exit(1) if os.path.isfile(options.install_upgrade) is True: - syncer(options.install_upgrade, apt_package_target_path, 1) + syncer(options.install_upgrade, apt_package_target_path, 1, bug_parse_required = True) elif os.path.isdir(options.install_upgrade) is True: - syncer(options.install_upgrade, apt_package_target_path, 2) + syncer(options.install_upgrade, apt_package_target_path, 2, bug_parse_required = True) else: log.err("%s file not found\n" % (options.install_upgrade)) sys.exit(1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-12 02:55:02
|
Revision: 183 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=183&view=rev Author: riteshsarraf Date: 2007-08-11 19:55:04 -0700 (Sat, 11 Aug 2007) Log Message: ----------- * String Formatting changes Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-11 17:47:20 UTC (rev 182) +++ trunk/pypt_core.py 2007-08-12 02:55:04 UTC (rev 183) @@ -69,9 +69,9 @@ bugTypes = ["Resolved bugs", "Normal bugs", "Minor bugs", "Wishlist items", "FIXED"] #These are spaces which will overwrite the progressbar left mess +LINE_OVERWRITE_SMALL = " " * 10 LINE_OVERWRITE_MID = " " * 30 LINE_OVERWRITE_FULL = " " * 60 -LINE_OVERWRITE_SMALL = " " * 15 # How many times should we retry on socket timeouts SOCKET_TIMEOUT_RETRY = 5 @@ -588,15 +588,13 @@ try: data.write (temp.read(block_size)) except socket.timeout, timeout: - print timeout socket_timeout = True socket_counter += 1 except socket.error, error: - print error socket_timeout = True socket_counter += 1 if socket_counter == SOCKET_TIMEOUT_RETRY: - errfunc(10054, "Max timeout retry count reached. Discontinuing file %s.\n", file) + errfunc(101010, "Max timeout retry count reached. Discontinuing download.\n", file) return False #break if socket_timeout is True: @@ -633,7 +631,7 @@ errfunc(e.code, e.reason, file) except socket.timeout: - errfunc(10054, "Socket timeout.", file) + errfunc(10054, "Socket timeout.\n", file) def copy_first_match(cache_dir, filename, dest_dir, checksum): # aka new_walk_tree_copy() '''Walks into "reposiotry" looking for "filename". @@ -656,7 +654,7 @@ try: shutil.copy(os.path.join(path, file), dest_dir) except shutil.Error: - log.verbose("%s already available in dest_dir. Skipping copy!!!\n\n" % (file)) + log.verbose("%s already available in dest_dir. Skipping copy!!!\n" % (file)) return True return False @@ -700,11 +698,12 @@ This function does the job of behaving accordingly as per the error codes. ''' - error_codes = [-3, 13, 504, 404, 10060, 104, 10054] + error_codes = [-3, 13, 504, 404, 10060, 104, 101010] # 104, 'Connection reset by peer' # 504 is for gateway timeout # 404 is for URL error. Page not found. # 10060 is for Operation Time out. There can be multiple reasons for this timeout + # 101010 is for socket max retry count # 10054 is for Socket Timeout. Socket Timeout are seen during network congestion #TODO: Find out what these error codes are for @@ -712,9 +711,13 @@ # 13 is for "Permission Denied" when you don't have privileges to access the destination if errno in error_codes: log.err("%s - %s - %s.%s\n" % (filename, errno, errormsg, LINE_OVERWRITE_MID)) - log.verbose(" Will still try with other package uris\n\n") + log.verbose("Will still try with other package uris\n") pass + elif errno == 10054: + log.verbose("%s - %s - %s.%s\n" % (filename, errno, errormsg, LINE_OVERWRITE_SMALL) ) + pass + elif errno == 407 or errno == 2: # These, I believe are from OSError/IOError exception. # I'll document it as soon as I confirm it. @@ -882,11 +885,11 @@ PackageName += " - " + temp_file[len(temp_file) - 1] del temp_file - log.msg("Downloading %s\n" % (PackageName) ) + log.msg("Downloading %s.%s\n" % (PackageName, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) != True: errlist.append(file) else: - log.success("\n%s done.\n" % (PackageName) ) + log.success("%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) if ArgumentOptions.zip_it: if FetcherInstance.compress_the_file(zip_update_file, file) != True: log.verbose("%s added to archive %s.\n" % (file, zip_update_file) ) @@ -897,7 +900,7 @@ elif key == 'Upgrade': PackageName = file.split("_")[0] if cache_dir is None: - log.msg("Downloading %s - %d KB\n" % (file, size/1024 ) ) + log.msg("Downloading %s - %d KB%s\n" % (file, size/1024, LINE_OVERWRITE_FULL) ) if FetcherInstance.download_from_web(url, file, download_path) != True: errlist.append(PackageName) @@ -911,7 +914,7 @@ log.verbose("Couldn't fetch bug reports for package %s.\n" % (PackageName) ) if ArgumentOptions.zip_it: - log.success("\n%s done.\n" % (PackageName) ) + log.success("%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) FetcherInstance.compress_the_file(zip_upgrade_file, file) os.unlink(os.path.join(download_path, file)) @@ -921,12 +924,12 @@ else: if find_first_match(cache_dir, file, download_path, checksum) == False: - log.msg("Downloading %s - %d KB\n" % (PackageName, size/1024 ) ) + log.msg("Downloading %s - %d KB%s\n" % (PackageName, size/1024, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) != True: errlist.append(PackageName) else: - log.success("\n%s done.\n" % (PackageName) ) + log.success("%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) if os.access(os.path.join(cache_dir, file), os.F_OK): log.verbose("%s file is already present in cache-dir %s. Skipping copy.\n" % (file, cache_dir) ) #INFO: The file is already there. else: @@ -1015,7 +1018,7 @@ exit_status = response.get() if exit_status == False: - log.msg("Downloading %s.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) + log.msg("Downloading %s.%s\n" % (PackageName, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) == True: log.success("\r%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) @@ -1068,7 +1071,7 @@ shutil.copy(full_file_path, download_path) log.success("%s copied from local cache directory %s.%s\n" % (PackageName, cache_dir, LINE_OVERWRITE_MID) ) except shutil.Error: - log.verbose("%s already available in %s. Skipping copy!!!%s\n\n" % (file, download_path, LINE_OVERWRITE_MID) ) + log.verbose("%s already available in %s. Skipping copy!!!%s\n" % (file, download_path, LINE_OVERWRITE_MID) ) if bug_fetched == 1: for x in os.listdir(os.curdir): @@ -1080,7 +1083,7 @@ # The file is corrupted and we need to download a new copy from the internet else: log.verbose("%s MD5 checksum mismatch. Skipping file.%s\n" % (file, LINE_OVERWRITE_FULL) ) - log.msg("Downloading %s - %d KB%s\n" % (PackageName, download_size/1024, LINE_OVERWRITE_FULL) ) + log.msg("Downloading %s - %d KB%s\n" % (PackageName, download_size/1024, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) == True: log.success("\r%s done.%s\n" % (PackageName, LINE_OVERWRITE_FULL) ) @@ -1090,7 +1093,7 @@ shutil.copy(file, cache_dir) log.verbose("%s copied to local cache directory %s.%s\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_MID) ) except shutil.Error: - log.verbose("Couldn't copy %s to %s.%s\n\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_FULL) ) + log.verbose("Couldn't copy %s to %s.%s\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_FULL) ) #Fetch bug reports if ArgumentOptions.deb_bugs: @@ -1135,7 +1138,7 @@ shutil.copy(full_file_path, download_path) log.success("%s copied from local cache directory %s.%s\n" % (file, cache_dir, LINE_OVERWRITE_SMALL) ) except shutil.Error: - log.verbose("%s already available in dest_dir. Skipping copy!!!%s\n\n" % (file, LINE_OVERWRITE_SMALL) ) + log.verbose("%s already available in dest_dir. Skipping copy!!!%s\n" % (file, LINE_OVERWRITE_SMALL) ) # And also the bug reports if bug_fetched == 1: @@ -1148,7 +1151,7 @@ #INFO: This block gets executed if the file is not found in local cache_dir or cache_dir is None # We go ahead and try to download it from the internet log.verbose("%s not available in local cache %s.%s\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_MID) ) - log.msg("Downloading %s - %d KB%s\n" % (PackageName, download_size/1024, LINE_OVERWRITE_FULL) ) + log.msg("Downloading %s - %d KB%s\n" % (PackageName, download_size/1024, LINE_OVERWRITE_MID) ) if FetcherInstance.download_from_web(url, file, download_path) == True: #INFO: This block gets executed if md5checksum is allowed @@ -1160,7 +1163,7 @@ shutil.copy(file, ArgumentOptions.cache_dir) log.verbose("%s copied to local cache directory %s.%s\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_MID) ) except shutil.Error: - log.verbose("%s already available in %s. Skipping copy!!!%s\n\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_MID) ) + log.verbose("%s already available in %s. Skipping copy!!!%s\n" % (file, ArgumentOptions.cache_dir, LINE_OVERWRITE_MID) ) if ArgumentOptions.deb_bugs: if FetchBugReportsDebian.FetchBugsDebian(PackageName): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-11 17:47:25
|
Revision: 182 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=182&view=rev Author: riteshsarraf Date: 2007-08-11 10:47:20 -0700 (Sat, 11 Aug 2007) Log Message: ----------- * Handle socket timeouts. We need to retry for a certain amount for a file untill finally giving up on it. * We also need to make sure that when in between a read of a particular file, we need to retry in case of a timeout. We can't just omit it on 1st timeout. * pypt-offline is supposed to be run at places where internet will be expensive. So obviously it will also be slow. Slow with timeouts..... ;-) * socket exception looks to be errcode 10054 * minor cleanups Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-10 23:08:03 UTC (rev 181) +++ trunk/pypt_core.py 2007-08-11 17:47:20 UTC (rev 182) @@ -72,6 +72,9 @@ LINE_OVERWRITE_MID = " " * 30 LINE_OVERWRITE_FULL = " " * 60 LINE_OVERWRITE_SMALL = " " * 15 + +# How many times should we retry on socket timeouts +SOCKET_TIMEOUT_RETRY = 5 class MD5Check: @@ -579,8 +582,27 @@ #INFO: Add the download thread into the Global ProgressBar Thread self.addItem(size) + socket_counter = 0 while i < size: - data.write (temp.read(block_size)) + socket_timeout = None + try: + data.write (temp.read(block_size)) + except socket.timeout, timeout: + print timeout + socket_timeout = True + socket_counter += 1 + except socket.error, error: + print error + socket_timeout = True + socket_counter += 1 + if socket_counter == SOCKET_TIMEOUT_RETRY: + errfunc(10054, "Max timeout retry count reached. Discontinuing file %s.\n", file) + return False + #break + if socket_timeout is True: + errfunc(10054, "Socket Timeout. Retry - %d\n" % (socket_counter) , file) + continue + increment = min(block_size, size - i) i += block_size counter += 1 @@ -594,21 +616,15 @@ #FIXME: Find out optimal fix for this exception handling except OSError, (errno, strerror): - #log.err("%s\n" %(download_dir)) errfunc(errno, strerror, download_dir) except urllib2.HTTPError, errstring: - #log.err("%s\n" % (file)) errfunc(errstring.code, errstring.msg, file) except urllib2.URLError, errstring: - #We pass error code "1" here becuase URLError - # doesn't pass any error code. # URLErrors shouldn't be ignored, hence program termination if errstring.reason.args[0] == 10060: errfunc(errstring.reason.args[0], errstring.reason, url) - #errfunc(1, errstring.reason) - #pass except IOError, e: if hasattr(e, 'reason'): @@ -617,7 +633,7 @@ errfunc(e.code, e.reason, file) except socket.timeout: - errfunc(101010, "Socket timeout.", file) + errfunc(10054, "Socket timeout.", file) def copy_first_match(cache_dir, filename, dest_dir, checksum): # aka new_walk_tree_copy() '''Walks into "reposiotry" looking for "filename". @@ -684,13 +700,12 @@ This function does the job of behaving accordingly as per the error codes. ''' - error_codes = [-3, 13, 504, 404, 10060, 104, 101010] + error_codes = [-3, 13, 504, 404, 10060, 104, 10054] # 104, 'Connection reset by peer' # 504 is for gateway timeout # 404 is for URL error. Page not found. # 10060 is for Operation Time out. There can be multiple reasons for this timeout - # 101010 - Dummy error code for socket timeouts. FIXME: Find the - # correct socket timeout error code + # 10054 is for Socket Timeout. Socket Timeout are seen during network congestion #TODO: Find out what these error codes are for # and better document them the next time you find it out. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-10 23:08:05
|
Revision: 181 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=181&view=rev Author: riteshsarraf Date: 2007-08-10 16:08:03 -0700 (Fri, 10 Aug 2007) Log Message: ----------- * Change No Bugs log level to 'msg' * Display the bugs subject line also along with the bug number Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-10 22:04:27 UTC (rev 180) +++ trunk/pypt_core.py 2007-08-10 23:08:03 UTC (rev 181) @@ -258,7 +258,7 @@ if self.platform == 'posix': sys.stdout.write(self.color_syntax + self.color[color]) - sys.stderr.write(self.color_syntax + self.color(color)) + sys.stderr.write(self.color_syntax + self.color[color]) elif self.platform == 'microsoft': WConio.textcolor(self.color[color]) @@ -1252,9 +1252,10 @@ def list_bugs(): log.msg("\n\nFollowing are the list of bugs present.\n") - for each_bug in bugs_number: - each_bug = each_bug.split('.')[1] - log.msg("%s\n" % (each_bug) ) + for each_bug in bugs_number.keys(): + bug_num = each_bug.split('.')[1] + bug_subject = bugs_number[each_bug] + log.msg("%s\t%s\n" % (bug_num, bug_subject) ) if arg_type == 1: try: @@ -1270,10 +1271,17 @@ sys.exit(1) file = zipfile.ZipFile(install_file_path, "r") - bugs_number = [] + bugs_number = {} for filename in file.namelist(): if filename.endswith(pypt_bug_file_format): - bugs_number.append(filename) + bug_subject_file = file.read(filename) + bug_subject = bug_subject_file.split('\r') + del bug_subject_file + for subject in bug_subject: + if subject.startswith('#'): + subject = subject.lstrip(subject.split(":")[0]) + break + bugs_number[filename] = subject if bugs_number: # Display the list of bugs @@ -1347,10 +1355,10 @@ log.err('Incorrect choice. Exiting\n') sys.exit(1) else: - log.verbose("Great!!! No bugs found for all the packages that were downloaded.\n") + log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") response = raw_input("Continue with Installation. Y/N ?") response = response.rstrip("\r") - if response.endswith('y') or reponse.endswith('Y'): + if response.endswith('y') or response.endswith('Y'): log.verbose("Continuing with syncing the files.\n") for filename in file.namelist(): @@ -1445,7 +1453,7 @@ log.err('Incorrect choice. Exiting\n') sys.exit(1) else: - log.verbose("Great!!! No bugs found for all the packages that were downloaded.\n") + log.msg("Great!!! No bugs found for all the packages that were downloaded.\n") response = raw_input("Continue with Installation. Y/N?") response = response.rstrip("\r") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-10 22:05:05
|
Revision: 180 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=180&view=rev Author: riteshsarraf Date: 2007-08-10 15:04:27 -0700 (Fri, 10 Aug 2007) Log Message: ----------- C:\Eclipse\Workspace\pypt-offline>hg log -l 3 -v changeset: 148:2ce875b21899 branch: trunk tag: tip user: Ritesh Raj Sarraf <rr...@re...> date: Sat Aug 11 03:31:00 2007 +0530 files: TODO pypt_core.py description: * I don't understand why import under __init__() aren't allowed. I mean, they make perfect sense to me. Anyway, for now, live with the common ugly (IMO) way. * Updates in the TODO changeset: 147:581b615c5324 branch: trunk user: Ritesh Raj Sarraf <rr...@re...> date: Sat Aug 11 03:03:00 2007 +0530 files: pypt_core.py description: * We should only be checking for 'microsoft' here. * stderr also need to be color changed Modified Paths: -------------- trunk/TODO trunk/pypt_core.py Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-08-10 12:18:13 UTC (rev 179) +++ trunk/TODO 2007-08-10 22:04:27 UTC (rev 180) @@ -6,10 +6,10 @@ * Proxy Authentication * Implement a function which will keep track of the failed uris and print them at last. It'll keep the uri and it's failure reason as a dictionary <done> * Implement Threads - When we implement threads multiple files will be downloaded at the same time. <done> - At that point, say we execute with 5 threads, the progressbar for all 5 threads should be displayed together. + At that point, say we execute with 5 threads, the progressbar for all 5 threads should be displayed together. <done> * Implement Curses and GUI interfaces. For these UIs it will be interactive. For all the options, only one will be selectable and once that option is selected the others will be deactivated. That's design, only one option allowed a time. :-) * Use Python's logging module to better handle messages, warnings and errors <done> * Implement apt's newly added feature (> 0.6.4) of Package Diff -* Add functionality for Offline Bug Reports +* Add functionality for Offline Bug Reports <done> * Handle KeyboardInterrupt exception in threads so that if the user sends an interrupt signal, the program should exit \ No newline at end of file Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-10 12:18:13 UTC (rev 179) +++ trunk/pypt_core.py 2007-08-10 22:04:27 UTC (rev 180) @@ -43,11 +43,11 @@ except ImportError: pass -#WindowColor = True -#try: -# import WConio -#except ImportError: -# WindowColor = False +WindowColor = True +try: + import WConio +except ImportError: + WindowColor = False '''This is the core module. It does the main job of downloading packages/update packages,\nfiguring out if the packages are in the local cache, handling exceptions and many more stuff''' @@ -236,7 +236,15 @@ 'Blink': '5m', 'SwitchOffAttributes': '0m'} elif os.name in ['nt', 'dos']: - self.platform = 'microsoft' + self.platform = None + + #try: + # import WConio + #except ImportError: + # self.platform = None + if WindowColor is True: + self.platform = 'microsoft' + self.color = {'Red': 4, 'Black': 0, 'Green': 2, 'White': 15, 'LightRed': 12, 'LightCyan': 11, @@ -250,7 +258,8 @@ if self.platform == 'posix': sys.stdout.write(self.color_syntax + self.color[color]) - elif self.platform in ['n', 'dos']: + sys.stderr.write(self.color_syntax + self.color(color)) + elif self.platform == 'microsoft': WConio.textcolor(self.color[color]) def msg(self, msg): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rit...@us...> - 2007-08-10 12:18:10
|
Revision: 179 http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=179&view=rev Author: riteshsarraf Date: 2007-08-10 05:18:13 -0700 (Fri, 10 Aug 2007) Log Message: ----------- * This commit bring the color support for both the platforms - POSIX * Compliant ones and Windows. * For some reasons (which I'm yet to root cause), log.err('Red') doesn't * print in red. * After this commit, testing it on Windows still remains to be done. Modified Paths: -------------- trunk/pypt_core.py Modified: trunk/pypt_core.py =================================================================== --- trunk/pypt_core.py 2007-08-09 21:07:59 UTC (rev 178) +++ trunk/pypt_core.py 2007-08-10 12:18:13 UTC (rev 179) @@ -43,11 +43,11 @@ except ImportError: pass -WindowColor = True -try: - import WConio -except ImportError: - WindowColor = False +#WindowColor = True +#try: +# import WConio +#except ImportError: +# WindowColor = False '''This is the core module. It does the main job of downloading packages/update packages,\nfiguring out if the packages are in the local cache, handling exceptions and many more stuff''' @@ -212,67 +212,85 @@ Now for example, say I wanted blinking, yellow text on a magenta background... I'd type ESC[45;33;5m ''' - def __init__(self, verbose, color = None, lock = None): - + def __init__(self, verbose, lock = None): + if verbose is True: self.VERBOSE = True else: self.VERBOSE = False - self.color = color + self.color_syntax = '\033[1;' if lock is None or lock != 1: self.DispLock = False else: self.DispLock = threading.Lock() self.lock = True + + if os.name == 'posix': + self.platform = 'posix' + self.color = {'Red': '31m', 'Black': '30m', + 'Green': '32m', 'Yellow': '33m', + 'Blue': '34m', 'Magneta': '35m', + 'Cyan': '36m', 'White': '37m', + 'Bold_Text': '1m', 'Underline': '4m', + 'Blink': '5m', 'SwitchOffAttributes': '0m'} + + elif os.name in ['nt', 'dos']: + self.platform = 'microsoft' + self.color = {'Red': 4, 'Black': 0, + 'Green': 2, 'White': 15, + 'LightRed': 12, 'LightCyan': 11, + 'SwitchOffAttributes': 15} + else: + self.platform = None + self.color = None + + def set_color(self, color): + '''Check the platform and set the color''' + if self.platform == 'posix': + sys.stdout.write(self.color_syntax + self.color[color]) + elif self.platform in ['n', 'dos']: + WConio.textcolor(self.color[color]) + def msg(self, msg): - 'Print general messages' + '''Print general messages. If locking is available use them.''' if self.lock: self.DispLock.acquire(True) - - if self.color: - WConio.textcolor(15) - + + self.set_color('White') sys.stdout.write(msg) sys.stdout.flush() + self.set_color('SwitchOffAttributes') if self.lock: self.DispLock.release() def err(self, msg): - 'Print messages with an error' + '''Print messages with an error. If locking is available use them.''' if self.lock: self.DispLock.acquire(True) - if self.color: - WConio.textcolor(4) - + self.set_color('Red') sys.stderr.write(msg) sys.stderr.flush() - - if self.color: - WConio.textcolor(15) #Once the error is displayed, change back to the normal color + self.set_color('SwitchOffAttributes') if self.lock: self.DispLock.release() def success(self, msg): - 'Print messages with a success' + '''Print messages with a success. If locking is available use them.''' if self.lock: self.DispLock.acquire(True) - if self.color: - WConio.textcolor(2) - + self.set_color('Green') sys.stdout.write(msg) sys.stdout.flush() - - if self.color: - WConio.textcolor(15) #Once the error is displayed, change back to the normal color + self.set_color('SwitchOffAttributes') if self.lock: self.DispLock.release() @@ -280,23 +298,22 @@ # For the rest, we need to check the options also def verbose(self, msg): - 'Print verbose messages' + '''Print verbose messages. If locking is available use them.''' if self.lock: self.DispLock.acquire(True) if self.VERBOSE is True: - if self.color: - WConio.textcolor(11) - + + self.set_color('Cyan') sys.stdout.write(msg) sys.stdout.flush() - if self.color: - WConio.textcolor(15) #Once the error is displayed, change back to the normal color + self.set_color('SwitchOffAttributes') if self.lock: self.DispLock.release() + class Archiver: def __init__(self, lock=None): if lock is None or lock != 1: @@ -1517,7 +1534,7 @@ # The log implementation # Instantiate the class global log - log = Log(options.verbose, WindowColor, lock = True) + log = Log(options.verbose, lock = True) log.msg("pypt-offline %s\n" % (version)) log.msg("Copyright %s\n" % (copyright)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |