Ejemplo n.º 1
0
def mkfile(filename, content):
    if filename[0:1] == "/":
        filename = filename[1:]
    realfile = path.join(SRCDIR, filename)
    realdir = path.dirname(realfile)
    print "Creating %s in %s [SRCDIR=%s]" % (realfile, realdir, SRCDIR)
    mkdirs.mkdirs(realdir)
    of = open(realfile, "w")
    of.write(content)
    of.close()
Ejemplo n.º 2
0
 def open(self, token):
     """Opens a temp file for a token, returns the filehandle."""
     if token[0:1] == "/":
         token = token[1:]
     linkfile = path.join(self.rootdir, token)
     revsdir = "%s-revs" % linkfile
     mkdirs.mkdirs(revsdir)
     timestamp = strftime("%Y%m%d-%H%M%S", localtime(time()))
     counter = 1
     while path.exists(path.join(revsdir, timestamp)):
         counter += 1
         timestamp = "%s-%d" % (timestamp, counter)
     extension = "-edit%d" % (int(random.random() * 10000))
     outfilename = path.join(revsdir, "%s-%s" % (timestamp, extension))
     args = (linkfile, timestamp, extension, revsdir)
     return RevisionedStorage.TempRevFile(outfilename, self, args)
Ejemplo n.º 3
0
 def make_dirs(self):
  # create dirs for video files 
  import mkdirs
  p=mkdirs.mkdirs()
  p.main()

  # hack to save some of these values for other tests
  self.show_dir = p.show_dir
  self.show=Show.objects.get(slug=p.options.show)
  self.options = p.options
  self.sh_pathname = os.path.join( 
          self.show_dir, 'tmp', "%s.sh" % (self.title) )
  return
Ejemplo n.º 4
0
    def make_dirs(self):
        # create dirs for video files
        import mkdirs
        p = mkdirs.mkdirs()
        p.main()

        # hack to save some of these values for other tests
        self.show_dir = p.show_dir
        self.show = Show.objects.get(slug=p.options.show)
        self.options = p.options
        self.sh_pathname = os.path.join(self.show_dir, 'tmp',
                                        "%s.sh" % (self.slug))
        return
Ejemplo n.º 5
0
 def __init__(self, dir):
     self.rootdir = dir
     mkdirs.mkdirs(self.rootdir)
Ejemplo n.º 6
0
if not os.path.exists('/home/servidor'):
    print "Creando el usuario servidor"
    os.system('useradd servidor')
    print "Configurando el usuario"
    print "Utiliza la contraseña grupos, para que las XO se puedan conectar"
    os.system('passwd servidor')
    os.system('chown %s %s' % (raw_input('Escribe tu nombre de usuario: '),
                               '/home/servidor'))
    shutil.copyfile('/usr/share/antipapel/log.txt', '/home/servidor/log.txt')
    shutil.copyfile('/usr/share/antipapel/serial_numbers.txt',
                    '/home/servidor/serial_numbers.txt')
    os.system('chmod %s %s' % ('777', '/home/servidor/log.txt'))
    os.system('chmod %s %s' % ('777', '/home/servidor/serial_numbers.txt'))

    import mkdirs
    mkdirs.mkdirs()
    mkdirs.make_desc_files()

import widgets

from widgets import GROUPS, SUBJECTS
import gtk
import json
import keys
import logexplorer

GROUPS_DIR = os.path.join('/home/servidor', 'Groups')


class Window(gtk.Window):
    '''Ventana'''
Ejemplo n.º 7
0
#!/usr/bin/python

import os
from os import path
import tempfile
import shutil
import mkdirs
from revdir import RevisionedStorage

# Testing the revdir.py class

TMPDIR = tempfile.mkdtemp()
print "Storm happening in %s" % TMPDIR
REVDIR = path.join(TMPDIR, "revd")
mkdirs.mkdirs(REVDIR)
SRCDIR = path.join(TMPDIR, "src")
mkdirs.mkdirs(SRCDIR)
print "REVDIR=%s  SRCDIR=%s" % (REVDIR, SRCDIR)


def mkfile(filename, content):
    if filename[0:1] == "/":
        filename = filename[1:]
    realfile = path.join(SRCDIR, filename)
    realdir = path.dirname(realfile)
    print "Creating %s in %s [SRCDIR=%s]" % (realfile, realdir, SRCDIR)
    mkdirs.mkdirs(realdir)
    of = open(realfile, "w")
    of.write(content)
    of.close()