(self)
| 593 | os.makedirs(path) |
| 594 | |
| 595 | def _generate_create_date(self) -> datetime.datetime: |
| 596 | if self.timezone is not None: |
| 597 | if ZoneInfo is None: |
| 598 | raise util.CommandError( |
| 599 | "Python >= 3.9 is required for timezone support or " |
| 600 | "the 'backports.zoneinfo' package must be installed." |
| 601 | ) |
| 602 | # First, assume correct capitalization |
| 603 | try: |
| 604 | tzinfo = ZoneInfo(self.timezone) |
| 605 | except ZoneInfoNotFoundError: |
| 606 | tzinfo = None |
| 607 | if tzinfo is None: |
| 608 | try: |
| 609 | tzinfo = ZoneInfo(self.timezone.upper()) |
| 610 | except ZoneInfoNotFoundError: |
| 611 | raise util.CommandError( |
| 612 | "Can't locate timezone: %s" % self.timezone |
| 613 | ) from None |
| 614 | |
| 615 | create_date = datetime.datetime.now( |
| 616 | tz=datetime.timezone.utc |
| 617 | ).astimezone(tzinfo) |
| 618 | else: |
| 619 | create_date = datetime.datetime.now() |
| 620 | return create_date |
| 621 | |
| 622 | def generate_revision( |
| 623 | self, |
no outgoing calls