Metadir.create(): handle tiered repositories
[mw] / src / mw / metadir.py
index 89654b8b3a272b153b762c09755582c711fa6b32..06dbeb368b5046d672c682a984988e2406260274 100644 (file)
@@ -13,8 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# with this program.  If not, see <http://www.gnu.org/licenses/>.
 ###
 
 import ConfigParser
@@ -47,11 +46,11 @@ class Metadir(object):
 
     def create(self, api_url):
         # create the directory
-        try:
-            os.mkdir(self.location, 0755)
-        except OSError, e:
+        if os.path.isdir(self.location):
             print '%s: you are already in a mw repo' % self.me
             sys.exit(1)
+        else:
+            os.mkdir(self.location, 0755)
         # create config
         self.config = ConfigParser.RawConfigParser()
         self.config.add_section('remote')

Benjamin Mako Hill || Want to submit a patch?